hasura / hasura/graphql-engine

CLI console fails to load in Chrome with CORS error

Open
#3,854 3 comments 0 reactions 1 assignee Claimed by @rikinsk View on GitHub
c/cli c/console support/needs-triage
Dominant language
TypeScript
Stars
32.1k
Forks
3k
PR merge metrics
PR metrics pending

Description

I'm using a hasura server hosted on heroku, and have developed a schema using the console accessed via the heroku page. Now I'm trying to only run the console locally.

When I run `hasura console` in my command prompt (Win 10) I get an error page in Chrome (v`79.0.3945.130`), but not in Firefox:

![image](https://user-images.githubusercontent.com/391950/74098383-987af400-4b6b-11ea-897d-ad9dc2a0f4bc.png)

Looking in the request through the dev tools, I can see that the correct `admin-secret` is supplied. It looks like the first `query` request fails with no response captured from the server:

![image](https://user-images.githubusercontent.com/391950/74098427-26ef7580-4b6c-11ea-986a-749d015714f6.png)

There are errors in the console indicating a CORS issue:

```
Access to fetch at 'https://ppp.herokuapp.com/v1/query' from origin 'http://localhost:9695' has
been blocked by CORS policy: Response to preflight request doesn't pass access control check:
The 'Access-Control-Allow-Origin' header has a value 'https://localhost:9695' that is not equal
to the supplied origin. Have the server send the header with a valid value, or, if an opaque
response serves your needs, set the request's mode to 'no-cors' to fetch the resource with
CORS disabled.

ppp.herokuapp.com/v1/query:1 Failed to load resource: net::ERR_FAILED

main.js.gz:1 Request error: TypeError: Failed to fetch
```

The heroku app has the following env vars

![image](https://user-images.githubusercontent.com/391950/74098454-75047900-4b6c-11ea-822a-009f84b0a058.png)

Running in Firefox, the console loads as expected, but there are no preflight requests captured in the console so I can't easily compare the headers.

Its possible this is an issue with Chrome?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.