graphiql-app icon indicating copy to clipboard operation
graphiql-app copied to clipboard

Can't connect to localhost ECONNREFUSED

Open MikeyParton opened this issue 7 years ago • 5 comments
trafficstars

I Just did a fresh install of version 0.7.2 and I get the following error trying to load the schema when I put my endpoint in.

Error: connect ECONNREFUSED 127.0.0.1:3000
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14)

The endpoint is: http://localhost:3000/api/graphql Weirdly enough if I use ngrok to forward requests to port 3000 and use the endpoint: https://bf29c0e6.ngrok.io/api/graphql, everything works.

Any clues to what the issue could be ? I tried installing with brew first and then uninstalled and tried the .dmg file from the releases page but I'm still having the same problem

MikeyParton avatar Apr 09 '18 22:04 MikeyParton

Any luck with this ?

dzanfardino avatar Jun 04 '19 14:06 dzanfardino

Same here on v 0.7.2:

Error: connect ECONNREFUSED 127.0.0.1:3000
    at Object.exports._errnoException (util.js:1026:11)
    at exports._exceptionWithHostPort (util.js:1049:20)
    at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1081:14)

Graphql server is running within a Rails app on port 3000 and doesn't report any refused connections.

ivdma avatar Aug 07 '19 11:08 ivdma

Also having the same problem. @dzanfardino @ivdma @MikeyParton did any of you guys ever sort this out?

joshglenn avatar Feb 26 '20 16:02 joshglenn

Nope, GraphiQL app went straight into the Trash.

Sent from my iPhone

On 26 Feb 2020, at 17:20, joshglenn [email protected] wrote:

 Also having the same problem. @dzanfardino @ivdma @MikeyParton did any of you guys ever sort this out?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

ivdma avatar Feb 26 '20 16:02 ivdma

@ivdma :-) frustrating, I'm sure.

As It turns out, I didn't have to throw it in the trash (It has worked well for me in many other projects).

It appears this problem is due to some sort of a security issue (cors or something like that).

Here's how I resolved it (on mac osx) :

  1. I added an entry to /etc/hosts:

    127.0.0.1    myproject.example.com
    
  2. Then, I configured my testing webserver to listen for connections coming in from host myproject.example.com.

  3. Finally, I navigated to myproject.example.com/endpoint using GraphiQL and did not get a connection refused error.

This keeps cors errors from blocking connections. Hope this helps.

joshglenn avatar Feb 26 '20 16:02 joshglenn