Skip to content
Back

Getting CORS error for GraphQL query on Vercel (also on localhost)

  • 0
  • Databases
  • Web
Samar Hayat
7 Aug, 2025, 23:40

Getting CORS error when making GraphQL queries using Appwrite's SDK in Next.js (client-side). Login/signup works fine. Only GraphQL is failing on both localhost and Vercel.

✅ Tried:

Added localhost + Vercel URLs in Appwrite project settings

Used setDevKey() in client config

API key + permissions are set correctly

Regular Appwrite SDK calls work – only GraphQL fails code snippet: ```const query = query { databasesListDocuments( databaseId: "${process.env.NEXT_PUBLIC_APPWRITE_DATABASE_ID}", collectionId: "6894bf11000015b5ba60" ) { title } } ; const res = await graphql.query({ query });

TypeScript
Question:
Is Appwrite GraphQL not supported on client-side yet? Or is any extra CORS config needed?
TL;DR
Developers are experiencing CORS error when making GraphQL queries in Next.js using Appwrite's SDK. Login/signup are working but GraphQL is failing on both localhost and Vercel. Solution: Appwrite GraphQL is supported on the client-side. Additional CORS configuration might be needed. Ensure to check Appwrite's documentation for potential troubleshooting steps.
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