postmanlabs / postman-app-support

Postman is an API platform for building and using APIs. Postman simplifies each step of the API lifecycle and streamlines collaboration so you can create better APIs—faster.
https://www.postman.com
5.85k stars 841 forks source link

WSL2 `ECONNREFUSED` on GraphQL Request #11836

Open kliakos opened 1 year ago

kliakos commented 1 year ago

Is there an existing issue for this?

Describe the Issue

While schema fetch and queries work fine with standard HTTP request and Body=GraphQL, the same doesn't work with the new GraphQL Request request type. The localhost domain should resolve to the WSL ip but it doesn't. Strangely, sometimes it works but can't reproduce it on a steady base.

Working:

image

Not working:

image

Steps To Reproduce

  1. Open a new GraphQL Request
  2. Add a GraphQL URL backed by a service running on WSL2
  3. Try to get schema from introspection

Screenshots or Videos

No response

Operating System

Windows 10

Postman Version

10.12.4

Postman Platform

Postman App

User Account Type

Signed In User

Additional Context?

No response

codenirvana commented 1 year ago

@kliakos Thanks for reporting this issue.

Strangely, sometimes it works but can't reproduce it on a steady base.

🤔 That's weird since both use the same request-sending library.

kliakos commented 1 year ago

@kliakos Thanks for reporting this issue.

Strangely, sometimes it works but can't reproduce it on a steady base.

🤔 That's weird since both use the same request-sending library.

The case that I have seen it to work is when I first do the schema fetch from the standard HTTP request tab, and then I try the same (get schema from instrospection) from the GraphQL Request tab. Seems like some kind of dns caching happens which is persisted for some time, but it doesn't last long. But this "trick" doesn't work all the time.

The temp workaround is to use the WSL ip directly instead of localhost, but of course I would expect this issue to be addressed at some time soon.

douglaswth commented 1 year ago

This seems to also affect Websocket Request. The WSL IP address workaround seems to work as well.

akshaysangma commented 1 year ago

related to #11204

ColeStansbury commented 2 months ago

related to #11204

to save others time here is the simplest solution that fixes this in the other issue: replace local host with wsl IP retrieved from wsl hostname -I

credit: https://github.com/postmanlabs/postman-app-support/issues/11204#issuecomment-1751987249

Dezainer commented 1 month ago

Guys, this has worked for me:

No more errors, the schema will be fetched as expected.