Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Uncaught SyntaxError missing ( after argument list #27

Open
Flachzange opened this issue Jul 6, 2023 · 0 comments
Open

Uncaught SyntaxError missing ( after argument list #27

Flachzange opened this issue Jul 6, 2023 · 0 comments

Comments

@Flachzange
Copy link

I was wondering why my frontend page kept being empty (index.html loaded but without data). As I did a lot of infrastructure changes I ignored it first.

Yesterday, I started digging and found the reason to be unescaped characters in pethubconfig.json. To be precise:

"Custom_Modes": "['Threeseconds', 'Metalmode2', 'Extendedrange']"

The loading function for the config sits in

return web.Response(content_type='application/javascript', body='pethubconfig=JSON.parse(\'' + json.dumps(request.app['pethubconfig']) + '\');')

and this then obviously results in a

Uncaught SyntaxError missing ( after argument list

A fix is to remove the JSON.parse entirely as you read JSON into JS which does not require any additional parsing:

return web.Response(content_type='application/javascript', body='pethubconfig=' + json.dumps(request.app['pethubconfig']))

This populates the frontend again without any errors.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant