SyntaxError: missing } after function body

The parser reached a point where it expected the function body to close. The missing closing brace may belong to a nested conditional, callback or object, which can make the outer function look incomplete as well. Use the file and line in the error to locate the relevant function.
Format the function and follow each opening brace to its partner. Check the generated file if your application uses a template or build step. A source template can look balanced while the branch that emits the JavaScript leaves out a brace.
function greet(name) { if (name) { return `Hello, ${name}`; } return 'Hello'; }
In greet(), the placement of the first closing brace determines whether the default greeting sits inside or outside the conditional. Preserve that structure when repairing your own code. Adding a brace at the end may make the file parse while moving a return into a different branch from the one intended.
Match the braces in the downloaded function, including each nested conditional, and reparse that exact code.