Apollo-client: httpLink.js:126 OPTIONS http://localhost:4444/graphql net::ERR_CONNECTION_REFUSED

Created on 13 Oct 2018  路  8Comments  路  Source: apollographql/apollo-client

For some unknown reason , for every change I make in my script , the
"dev": "concurrently --names \"server,client\" \"npm run server --silent\" \"npm run client --silent\""

that reloads on changes, gives me the error, if I reload manually after, all is ok.
I have a very basic setup, mostly boilerplate of the apollo getting started site.
any idea ?

> (anonymous) | @ | httpLink.js:126
> -- | -- | --
> 聽 | Subscription | @ | Observable.js:209
> 聽 | subscribe | @ | Observable.js:287
> 聽 | (anonymous) | @ | index.js:37
> 聽 | Subscription | @ | Observable.js:209
> 聽 | subscribe | @ | Observable.js:287
> 聽 | (anonymous) | @ | dedupLink.js:86
> 聽 | Subscription | @ | Observable.js:209
> 聽 | subscribe | @ | Observable.js:287
> 聽 | (anonymous) | @ | QueryManager.js:1044
> 聽 | QueryManager.fetchRequest | @ | QueryManager.js:1041
> 聽 | QueryManager.fetchQuery | @ | QueryManager.js:469
> 聽 | QueryManager.startQuery | @ | QueryManager.js:844
> 聽 | ObservableQuery.setUpQuery | @ | ObservableQuery.js:429
> 聽 | ObservableQuery.onSubscribe | @ | ObservableQuery.js:385
> 聽 | (anonymous) | @ | ObservableQuery.js:66
> 聽 | Subscription | @ | Observable.js:209
> 聽 | subscribe | @ | Observable.js:287

capture d ecran le 2018-10-13 a 15 55 54

馃毀 in-triage

Most helpful comment

Well before we investigate that, could you first check if it reloads or not?
Could be an issue that your nodemon is looking a level higher than supposed to or something.

All 8 comments

I have the same issue!

Isn't this because your subscription initializes quicker than your backend can restart, try implementing a wait-port on your frontend so your front only reloads after the backend port is available? :)

Isn't this because your subscription initializes quicker than your backend can restart, try implementing a wait-port on your frontend so your front only reloads after the backend port is available? :)

Thanks for answering, but why would the backend restart? It's just a apollo server waiting for query from apollo client in my react app, isn't it?

Well before we investigate that, could you first check if it reloads or not?
Could be an issue that your nodemon is looking a level higher than supposed to or something.

Wow, genius! The backend did reload on my frontend script change, why would that happen?馃憖

Hmm, so i assume concurrently is used so you can use 1 docker container to spin up two instances. This means that they are in the same volume, if your nodemon is watching / it would reload on frontend changes. This implies you should look at your backend start script.

Vice versa, you could try checking if frontend reloads on backend change, if not then the above will be your solution.

Sorry for troubling you, I'm so stupid, I put the frontend folder inside server folder, so nodemon reloads every time my frontend change, thanks so much for answering!馃お

Sounds like this has been resolved. Closing - thanks!

Was this page helpful?
0 / 5 - 0 ratings