hasura / hasura/graphql-engine
Docker 'InvalidUrlException' / 'Invalid scheme' in Remote Schema and Actions
- Dominant language
- TypeScript
- Stars
- 32.1k
- Forks
- 3k
- PR merge metrics
- PR metrics pending
Description
Hey everyone. I am using Hasura (latest) with Docker for Windows 10.
After I created some relationships, I wanted to try to add an external schema.
I created a dotnet core 5.0 graphql server where I could query data over the GraphiQl-Playground (not the one from Hasura) and Postman. So I am pretty convinced, that my "external" GraphQl-Server is working properly
My GraphQl server is available at `https://localhost:44368/graphql`.
So I tried to add the Remote Schema in Hasura with the URL `host.docker.internal:44368/graphql`. After pressing the "Add" Button, nothing happened. Even after minutes. It was stuck at the "Adding" status of the button.
In the Docker logs for Hasura, I found
```
{"type":"http-log","timestamp":"2021-07-02T15:25:58.530+0000","level":"error","detail":{"operation":{"user_vars":{"x-hasura-role":"admin"},"error":{"internal":"InvalidUrlException \"host.docker.internal:44368/graphql\" \"Invalid scheme\"","path":"$.args[0].args","error":"HTTP exception occurred while sending the request to host.docker.internal:44368/graphql","code":"remote-schema-error"},"request_id":"eecf0fb3-6216-49f2-9886-4afecc1b819a","response_size":243,"query":{"resource_version":11,"args":[{"args":{"definition":{"timeout_seconds":10,"url":"host.docker.internal:44368/graphql","headers":[],"forward_client_headers":true},"name":"my-remote-schema","comment":""},"version":1,"type":"add_remote_schema"}],"version":1,"type":"bulk"}},"request_id":"eecf0fb3-6216-49f2-9886-4afecc1b819a","http_info":{"status":400,"http_version":"HTTP/1.1","url":"/v1/metadata","ip":"172.18.0.1","method":"POST","content_encoding":null}}}
```
(Prettified):
```
{
"type":"http-log",
"timestamp":"2021-07-02T15:25:58.530+0000",
"level":"error",
"detail":{
"operation":{
"user_vars":{
"x-hasura-role":"admin"
},
"error":{
"internal":"InvalidUrlException \"host.docker.internal:44368/graphql\" \"Invalid scheme\"",
"path":"$.args[0].args",
"error":"HTTP exception occurred while sending the request to host.docker.internal:44368/graphql",
"code":"remote-schema-error"
},
"request_id":"eecf0fb3-6216-49f2-9886-4afecc1b819a",
"response_size":243,
"query":{
"resource_version":11,
"args":[
{
"args":{
"definition":{
"timeout_seconds":10,
"url":"host.docker.internal:44368/graphql",
"headers":[
],
"forward_client_headers":true
},
"name":"my-remote-schema",
"comment":""
},
"version":1,
"type":"add_remote_schema"
}
],
"version":1,
"type":"bulk"
}
},
"request_id":"eecf0fb3-6216-49f2-9886-4afecc1b819a",
"http_info":{
"status":400,
"http_version":"HTTP/1.1",
"url":"/v1/metadata",
"ip":"172.18.0.1",
"method":"POST",
"content_encoding":null
}
}
}
```
After a while, I Changed my GraphQl Server to a "normal" REST-API with the same functionality. I made sure (via Postman) that they are working properly. Then I tried to add a Mutation to my API via the Hasura Actions with the URL `host.docker.internal:44368/api/Controller`
The saving worked this time.
When I tried to run the mutation, I got the response
```
{
"0": "I",
"1": "n",
"2": "t",
"3": "e",
"4": "r",
"5": "n",
"6": "a",
"7": "l",
"8": " ",
"9": "S",
"10": "e",
"11": "r",
"12": "v",
"13": "e",
"14": "r",
"15": " ",
"16": "E",
"17": "r",
"18": "r",
"19": "o",
"20": "r"
}
```
and in the Docker logs I got
`Spock Error while handling ["v1","graphql"]: InvalidUrlException "host.docker.internal:44368/api/Controller" "Invalid scheme"`
Any ideas what I am doing wrong or any suggestions?
Thanks in advance and have an awesome weekend!
Contributor guide
Research direction
Start by reproducing the Remote Schema and Action requests using the reported host.docker.internal URLs, then inspect the Hasura Docker logs for the InvalidUrlException. Done means determining why both URL forms produce an invalid-scheme error and documenting or fixing the behavior with a verified request.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker
- Domain
- api, backend
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100