Back

GraphQL | Explorer via Altair not accessible & CORS issue from web app

  • 0
  • Locale
  • GraphQL
  • Web
WimS.
15 Nov, 2023, 20:00

I've setup a locale environment within docker, created a database and a web app with corresponding hostname. I'm able to use the .listDocuments API. But when I try to use GraphQL, I get a CORS error.

Also when I want to access the GraphQL Explorer through Altair, I'm not able to load the schema/docs. _APP_OPTIONS_ABUSE is set as disabled as advised by https://gist.github.com/stnguyen90/8b6b80682d80cfec130a61e60e07d1f9#file-start-appwrite-graphql-explorer-sh-L3.

What should I do extra to avoid the CORS errors for GraphQL from within my web app? And how to access through the GraphQL Explorer/Altair?

TL;DR
The user is experiencing CORS errors when trying to use GraphQL from their web app and is also unable to load the schema/docs in Altair. They have already set `_APP_OPTIONS_ABUSE` to `disabled` as suggested in a guide. They are asking for advice on how to avoid the CORS errors and access the GraphQL Explorer/Altair. Solution: To avoid the CORS errors for GraphQL, the user should ensure that they have added the web app as a web platform in the console. Additionally, they should check if they have correctly set up their environment within Docker and created a database and web app with the corresponding hostname. To access the
Drake
15 Nov, 2023, 21:45

Where are you making the API calls from?

Drake
15 Nov, 2023, 21:45

A web app? Did you add the web app as a web platform?

WimS.
15 Nov, 2023, 22:23

Both from a web app and from the GraphQL playground (Altair). The web app is added as web platform.

WimS.
15 Nov, 2023, 22:28

I though, I would be able to create my own GraphQL queries/mutation. But apparently only those provided within the docs are available., right?

WimS.
15 Nov, 2023, 22:29

Something like query { todos( databaseId: "655502fec6ccfd1dbd82" ) { _id description } } won't be possible, I guess?

D5
15 Nov, 2023, 22:52

Did you have added a platform in the console with the corresponding domain?

WimS.
16 Nov, 2023, 20:48

Yes, the platform is added with the corresponding domain. It's working fine. I wrongly thought, I could create my own GraphQL queries/mutations as I mentioned above. Apparently, it's not possible. Only those from the docs are supported, which makes GraphQL a less interesting option unfortunately. Anyway, the service as a whole is awesome.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more