Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cross-Origin Request Blocked => to fix it, I need to remove credentials in fetch call #127

Open
harobed opened this issue Jul 27, 2019 · 2 comments · May be fixed by #183
Open

Cross-Origin Request Blocked => to fix it, I need to remove credentials in fetch call #127

harobed opened this issue Jul 27, 2019 · 2 comments · May be fixed by #183

Comments

@harobed
Copy link

harobed commented Jul 27, 2019

I use graphql-voyager in this Proof of Concept poc-postgraphile-forum.

I have my graphql server on http://127.0.0.1:5000/graphql (powered by postgraphile).

graphql-voyager is exposed on http://127.0.0.1:3001 and load graphql schema on http://127.0.0.1:5000/graphql.

Problem: I have this error in my browser:

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1:5000/graphql. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://127.0.0.1:5000/graphql. (Reason: CORS request did not succeed).
TypeError: NetworkError when attempting to fetch resource.

Capture d’écran 2019-07-27 à 09 25 42

To fix it, I need to remove credentials in fetch call, it is this line:

https://github.com/APIs-guru/graphql-voyager/blob/aea16b545e61c31a4de6cbbc833d94d596fb42db/src/middleware/render-voyager-page.ts#L53

At this time, I don't understand what is the credentials option aim.

Possible line of approach to fix it:

  1. remove credentials option if it is useless
  2. add graphql-voyager configuration option to enable / disable credentials option
@mrthankyou
Copy link

I experienced this issue as well. In my case I would prefer to be able to set the HTTP conditions on my own rather than the app assume what my HTTP conditions are.

@usmcamp0811
Copy link

I am running into this same problem. I am using Graphene + Flask in Docker to build out an API and wanted to also use Voyager but can't load the schema due to CORS error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants