Add a remote schema on Hasura from localhost rails server fails

Viewed 30

I am testing Hasura with docker on my localhost, and I would like to add a remote schema, from a graphql endpoint on my local environment (rails app, http://localhost:3000/graphql)

When I try to add the remote schema URL on Hasura (via http://host.docker.internal:3000/graphql), it fails with the following message:

Adding remote schema failed
Error in $: Failed reading: not a valid json value at '<!DOCTYPEhtml>'

And, I have no log on my rails server.

I tried to use ngrok to have an https endpoint, (https://6e12fa99336b.ngrok.io forwarding to localhost:3000) but I had the same message. My ngrok console did show a post to /graphql, with 403 Forbidden, and still no log on the rails server

However it works with a public external API (https://countries.trevorblades.com/graphql for instance)

Is there something that I am doing wrong, some headers missing ?

1 Answers

Ok, finally got it ! The issue was with rails, not having host.docker.internal as a registered host, thus rendering an HTML error page. After adding host.docker.internal to config.host everything worked.

Related