graphql / vscode-graphql

MIGRATED: VSCode GraphQL extension (autocompletion, go-to definition, syntax highlighting)
https://marketplace.visualstudio.com/items?itemName=Prisma.vscode-graphql
MIT License
557 stars 71 forks source link

Getting FetchError when running query #321

Closed daniel-a-leon closed 2 years ago

daniel-a-leon commented 3 years ago

Version 0.3.17 works for me so I reverted to that.

Actual Behavior

In GraphQL Execution Result window getting error FetchError: request to http://localhost:8081/api/graphql?profile failed, reason: write EPROTO 140519593723880:error:100000f7:SSL routines:OPENSSL_internal:WRONG_VERSION_NUMBER:../../third_party/boringssl/src/ssl/tls_record.cc:242:

Expected Behavior

Query to run without error.

Steps to Reproduce the Problem Or Description

.graphqlrc.yml:

projects:
  app:
    extensions:
      endpoints:
        default:
          url: http://localhost:8081/api/graphql?profile
          headers:
            Authorization: ApiKey ***

Execute any query. Get error.

Specifications

Logs Of TS Server || GraphQL Language Service

NetworkHelper: operation: query NetworkHelper: endpoint: http://localhost:8081/api/graphql?profile

tvvignesh commented 3 years ago

Facing the same error on my end as well sadly: image

francescob commented 2 years ago

I'm getting the same error, any solution for this?

archilkarchava commented 2 years ago

Changing localhost to 0.0.0.0 solves the issue for mac and linux. You can try exposing the dev server to your local network and replace localhost with your machine's internal IP address (e.g. 192.168.1.15) to make it work on windows.

sschneider-ihre-pvs commented 2 years ago

seems to work, but is no solution if you work in a team

adielBm commented 2 years ago

Changing localhost to 0.0.0.0 solves the issue for mac and linux. You can try exposing the dev server to your local network and replace localhost with your machine's internal IP address (e.g. 192.168.1.15) to make it work on windows.

I changed to 0.0.0.0, and it worked for me in Windows. Thanks @archilkarchava

acao commented 2 years ago

Huh! Strange!

i opened a ticket for our purposes

https://github.com/FormidableLabs/urql/issues/2114

is it a self signed certificate? Did you use the vscode setting to allow self signed certificates? We have to make it an opt-in choice because node security

acao commented 2 years ago

I will take a closer look after work tonight. Thanks for filing this bug and finding a workaround!

orestis commented 2 years ago

Hey @acao I ended up here because of this error - note that the OP is not using an https:// endpoint, instead using a plain http:// endpoint. I do the same. Could it be that the client is trying to establish an https connection on every url?

acao commented 2 years ago

@orestis interesting thought! I wonder...

acao commented 2 years ago

https://github.com/FormidableLabs/urql/issues/2114

I think this is caused by the issue-owner using a http endpoint but vscode-graphql using an https agent. I think your best bet would be to check whether endpoint.url is http and switch to that agent instead.

I accidentally chose to append the https agent regardless of the url. if someone creates a PR to check if uri.beginsWith("https") first before adding the agent to the fetcher then i can merge on lunch, otherwise it will have to wait until this weekend unfortunately

acao commented 2 years ago

Thanks @JoviDeCroock for the PR! The next release should be imminent with a fix. Lmk if I need to re-open. Thanks y‘all for helping us figure this one out!