Syntax Error: Expected Name, found } in GraphQL Explorer


When querying https://[MY_INSTANCE][REALM_PATH] in GraphQl explorer I receive “Invalid options provided to ApolloServer: Syntax Error: Expected Name, found }” and the documentation explorer says “No Schema Available”. When navigating to this Realm in Realm Studio there is definitely both a schema and data.

Where am I going wrong?

GraphQL not working with NodeJS created Realm?

This error usually indicates that the Realm file is empty (no schema and no data). Since you say that you can see the schema and data in Studio, can you double check that the paths are identical? If that’s the case, I’ll need a repro case or credentials to connect to your cloud instance to try and debug it.


Fixed - forgot to encode URL in the path. Thanks!


Sorry, @nirinchev, run into another problem.

The client I’m using to query the Realm GraphQL is encoding the “%2f” user to a “/user” (in bold below), which is causing a 404 error.


Encoding/Decoding other parts of the URL don’t affect the result (tested this in a browser) - only this character. Is there a workaround for this?


I’m not sure I understand the question - what is /user and why does it get appended to the url?


Thanks for your reply.

When using GraphQL, if %2fuser isn’t appended on to the request (https://[MY_INSTANCE][REALM_PATH]?query{QUERY}) I get a “Invalid options provided to ApolloServer: Syntax Error: Expected Name, found }” error. This is resolved when appending “%2fuser” to the path


The issue is, the client I’m using to query Realm is decoding the “%2f” to “/”


Which is returning “Cannot GET /graphql/[REALM_PATH]/user”

Is there an alternative path accessing a realm, other than encoding “%2fuser”?


What client are you using? This seems like a bug in the client - it should not be trying to decode the service urls. Also, can you post the code that you use to setup the client?


Thanks, It’s definitely a bug on the client side and been logged with them as such (using MS Power BI/Power Query).

I was wondering if there was a workaround on the realm side, given that only that character must be encoded?

I’ve tested queries in a browser but only that precise character seems to require encoding.


The slash needs to be encoded, yes. I can try and see if we can lift that limitation with a catch-all route parameter.


Brilliant - thank you very much!


@seann I made a change to our GraphQL service to handle non-encoded paths. It seems you’re running this on cloud, so you’ll need to wait for the next upgrade window, which will be mid-next week or if you PM me your instance id though, I can upgrade your instance to the latest version manually.