user3206236
user3206236

Reputation: 325

CORS Error with dgraph and apollo graphql

I am unable to run query requests with my local dGraph server.

I am running

  1. dGraph using docker compose with both zero and alpha
  2. React client side frontend using apollo-client graphql for running queries.

dGraph starts up fine, I have connected and run queries/mutations/etc through postman application, but when trying to run the exact same query through apollo it gives "Unable to fetch" error.

Any idea how I can configure either apollo or dGraph to accept CORS requests and ultimately run the query

Note - downloaded and ran the queries through apollo using the browser extension for allowing CORS requests and the UI then runs fine - pointing at the issue being something to do with the CORS configuration

Upvotes: 0

Views: 221

Answers (1)

user3206236
user3206236

Reputation: 325

After a lot of searching, I found that wildcards in the cors configuration on dgraph does not work. It must specify the full url. After specifying http://localhost:3000 then Cors started working

Upvotes: -1

Related Questions