Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
04-27-2020 09:56 AM
Hi!
So I got this error using npm run seedDb in the Grand stack starter project:
(base) Kaspers-MBP:api kasperknudsen$ npm run seedDb
> grand-stack-starter-api@0.0.1 seedDb /Users/kasperknudsen/grand-stack-starter-master/api
> babel-node src/seed/seed-db.js
ApolloError: Network error: request to http://localhost:4000/ failed, reason: connect ECONNREFUSED 127.0.0.1:4000
at new ApolloError (/Users/kasperknudsen/grand-stack-starter-master/api/node_modules/apollo-client/bundle.umd.js:92:26)
at Object.error (/Users/kasperknudsen/grand-stack-starter-master/api/node_modules/apollo-client/bundle.umd.js:1329:28)
at notifySubscription (/Users/kasperknudsen/grand-stack-starter-master/api/node_modules/zen-observable/lib/Observable.js:134:18)
at onNotify (/Users/kasperknudsen/grand-stack-starter-master/api/node_modules/zen-observable/lib/Observable.js:165:3)
at SubscriptionObserver.error (/Users/kasperknudsen/grand-stack-starter-master/api/node_modules/zen-observable/lib/Observable.js:224:7)
at /Users/kasperknudsen/grand-stack-starter-master/api/node_modules/apollo-client/bundle.umd.js:1106:37
at Set.forEach (<anonymous>)
at Object.error (/Users/kasperknudsen/grand-stack-starter-master/api/node_modules/apollo-client/bundle.umd.js:1105:21)
at notifySubscription (/Users/kasperknudsen/grand-stack-starter-master/api/node_modules/zen-observable/lib/Observable.js:134:18)
at onNotify (/Users/kasperknudsen/grand-stack-starter-master/api/node_modules/zen-observable/lib/Observable.js:165:3) {
graphQLErrors: [],
networkError: FetchError: request to http://localhost:4000/ failed, reason: connect ECONNREFUSED 127.0.0.1:4000
at ClientRequest.<anonymous> (/Users/kasperknudsen/grand-stack-starter-master/api/node_modules/node-fetch/lib/index.js:1455:11)
at ClientRequest.emit (events.js:210:5)
at ClientRequest.EventEmitter.emit (domain.js:476:20)
at Socket.socketErrorListener (_http_client.js:406:9)
at Socket.emit (events.js:210:5)
at Socket.EventEmitter.emit (domain.js:476:20)
at emitErrorNT (internal/streams/destroy.js:92:8)
at emitErrorAndCloseNT (internal/streams/destroy.js:60:3)
at processTicksAndRejections (internal/process/task_queues.js:80:21) {
message: 'request to http://localhost:4000/ failed, reason: connect ECONNREFUSED 127.0.0.1:4000',
type: 'system',
errno: 'ECONNREFUSED',
code: 'ECONNREFUSED'
},
message: 'Network error: request to http://localhost:4000/ failed, reason: connect ECONNREFUSED 127.0.0.1:4000',
extraInfo: undefined
Any tips?
04-27-2020 11:37 AM
What happens when you call http://localhost:4000/graphql in the browser?
Perhaps it's a problem with the port number.
What is the value of GRAPHQL_LISTEN_PORT in /api/src/.env ?
04-27-2020 01:14 PM
GRAPHQL_URI=http://localhost:4000
Changed it to 4001 since that's where I run [http://localhost:4001/graphql] and got this error instead..:
> babel-node src/seed/seed-db.js
ApolloError: Network error: Unexpected token < in JSON at position 0
at new ApolloError (/Users/kasperknudsen/grand-stack-starter-master/api/node_modules/apollo-client/bundle.umd.js:92:26)
at Object.error (/Users/kasperknudsen/grand-stack-starter-master/api/node_modules/apollo-client/bundle.umd.js:1329:28)
at notifySubscription (/Users/kasperknudsen/grand-stack-starter-master/api/node_modules/zen-observable/lib/Observable.js:134:18)
at onNotify (/Users/kasperknudsen/grand-stack-starter-master/api/node_modules/zen-observable/lib/Observable.js:165:3)
at SubscriptionObserver.error (/Users/kasperknudsen/grand-stack-starter-master/api/node_modules/zen-observable/lib/Observable.js:224:7)
at /Users/kasperknudsen/grand-stack-starter-master/api/node_modules/apollo-client/bundle.umd.js:1106:37
at Set.forEach (<anonymous>)
at Object.error (/Users/kasperknudsen/grand-stack-starter-master/api/node_modules/apollo-client/bundle.umd.js:1105:21)
at notifySubscription (/Users/kasperknudsen/grand-stack-starter-master/api/node_modules/zen-observable/lib/Observable.js:134:18)
at onNotify (/Users/kasperknudsen/grand-stack-starter-master/api/node_modules/zen-observable/lib/Observable.js:165:3) {
graphQLErrors: [],
networkError: SyntaxError [ServerParseError]: Unexpected token < in JSON at position 0
at JSON.parse (<anonymous>)
at /Users/kasperknudsen/grand-stack-starter-master/api/node_modules/apollo-link-http/node_modules/apollo-link-http-common/src/index.ts:131:23
at processTicksAndRejections (internal/process/task_queues.js:93:5) {
name: 'ServerParseError',
response: Response {
size: 0,
timeout: 0,
[Symbol(Body internals)]: [Object],
[Symbol(Response internals)]: [Object]
},
statusCode: 404,
bodyText: '<!DOCTYPE html>\n' +
'<html lang="en">\n' +
'<head>\n' +
'<meta charset="utf-8">\n' +
'<title>Error</title>\n' +
'</head>\n' +
'<body>\n' +
'<pre>Cannot POST /</pre>\n' +
'</body>\n' +
'</html>\n'
},
message: 'Network error: Unexpected token < in JSON at position 0',
extraInfo: undefined
}
04-27-2020 11:12 PM
To my understanding, the relevant entries in your .env file should look like this:
GRAPHQL_LISTEN_PORT=4001
GRAPHQL_URI=http://localhost:4001/graphql
The /graphql part should not be omitted. The seedDB.js script reads this value:
const client = new ApolloClient({
link: new HttpLink({ uri: process.env.GRAPHQL_URI, fetch }),
cache: new InMemoryCache()
});
Hope that helps. I had some problems with the seedDB part in the beginning also, but today everything runs smoothly.
04-28-2020 12:52 AM
Thanks for helping but ending up still getting the ECONNREFUSED error with all the corrections..
04-28-2020 03:28 AM
I could reproduce the ECONNREFUSED error when the api server was not running (if I didn't run 'npm start' in the /api directory).
Which version of neo4j are you using?
05-03-2020 06:33 AM
Actually solved it by re-clone the starter pack + re-installing npm.
Now my only problem is that I can't get the data from seedDb visually in Neo desktop.
01-23-2021 08:57 AM
tl;dr - (example solution at bottom) : change the direction "OUT" and "IN" by removing the quotes around them in the api>src>schema.graphql file
So I was having the same error as well :
Error: Error: request to http://0.0.0.0:4001/graphql failed, reason: connect ECONNREFUSED 0.0.0.0:4001
as well as this:
19:51:40 React | [HPM] Error occurred while trying to proxy request /graphql from localhost:3000 to http://localhost:4001/graphql (ECONNREFUSED) (https://nodejs.org/api/errors.html#errors_common_system_errors)
I had just installed using yarn and followed directions to cd myMyNewApp and npm run start (also tried yarn run start) , opened new terminal and cd to api directory then npm run seedDB. Based on the link in the error message, this is my issue:
ECONNREFUSED (Connection refused): No connection could be made because the target machine actively refused it. This usually results from trying to connect to a service that is inactive on the foreign host.
HOWEVER - the working solution I found on a random site was this:
... remove the quotes around IN and OUT and you should be fine. PR that made the change -> Don't use string for relationship direction in relation directive · neo4j-graphql/neo4j-graphql-js@c...
So, your relation ship should NOT look like this: @relation(name: "IN_GENRE", direction: " OUT " ) But rather like this: @relation(name: "IN_GENRE", direction: OUT)
link to the site I found this solution : Error in version 2.19.1, GraphQLError: Argument "direction" has invalid value "OUT" - neo4j-graphql-...
Hope this helps!
02-03-2021 05:41 AM
Hi @Schmarj3 , am I understanding correctly that you had the same problem specifically with npm seedDb
or npm start
after running create-grandstack-app
?
I am having the same problems reported above. Updating the schema does seem to help with the error you report, but the original problem of the refused connection continues.
Interestingly, I notice that in the link you give to where you found the solution they are discussing moving from neo4j-graphql.js version 2.18.0 to 2.19.1. But the current create-grandstack-app is using 2.14.2, so I am surprised that we are still experiencing that problem.
02-03-2021 09:45 AM
Hi @yyakovson613. Yes, for all of the installs that I have done in the past two weeks (except for today), removing the quotes from all the schema directions worked for me. The only other time I had and slight issue was switching from sandbox to a local db instance. But that was because I didn't update the env file correctly.
Just installed the web-react version again to see if I missed anything else I might have done and created a blank local db instance v4.1.3 - but the first error I got was a vue error:
internal/modules/cjs/loader.js:883
09:00:02 api | throw err;
09:00:02 api | ^
09:00:02 api |
09:00:02 api | Error: Cannot find module '@vue/compiler-dom'
09:00:02 api | Require stack:
...
ran the following which worked
npm i @vue/compiler-dom
but now the module error is about postcss. Was hoping to reconstruct the ECONNREFUSED error but will have to wait.
All the sessions of the conference are now available online