Skip to content

Uncaught SyntaxError missing ( after argument list #27

@Flachzange

Description

@Flachzange

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions