Upgrade to Neo4j 4.1, now cannot connect to grandstack api

I have been running Neo4J V 3.5.19 with this docker script

docker run \
--publish=7474:7474 --publish=7687:7687 \
--volume=$HOME/neo4j/data:/data \
--volume=$HOME/neo4j/logs:/logs \
--env NEO4JLABS_PLUGINS='["apoc"]' \
--env NEO4J_AUTH=neo4j/test \
--name=neo4j \
--restart=always \
--detach \
neo4j:3.5.19

I was eventualy able to get 4.1 working with this script.

docker run \
-p 7474:7474 -p 7687:7687 \
--volume=$HOME/neo4j/data:/data \
--volume=$HOME/neo4j/logs:/logs \
--volume=$HOME/neo4j/plugins:/plugins \
-e NEO4J_apoc_export_file_enabled=true \
-e NEO4J_apoc_import_file_enabled=true \
-e NEO4J_apoc_import_file_use__neo4j__config=true \
-e NEO4JLABS_PLUGINS=\[\"apoc\"\] \
--env NEO4J_AUTH=neo4j/test \
--name=neo4j \
--restart=always \
--detach \
neo4j:latest

The Neo4j Browser is working fine, but I'm unable to connect from my app or the graphql playground. The same error is thrown in both places.

"code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "code": "ServiceUnavailable",
          "name": "Neo4jError",
          "stacktrace": [
            "Neo4jError: connect ECONNREFUSED 192.168.0.200:7687",

If I go back to the original v3.5 docker script everything works again.

Any ideas?

I know that for me when I made the switch over to 4.0 when I created the driver I had to add:

const driver = neo4j.driver(
    neo4jURI,
    neo4j.auth.basic(
        neo4jUser,
        neo4jPassword
    ),
    {
        encrypted: development ? "ENCRYPTION_OFF" : "ENCRYPTION_ON"
    }
);

This encryption flag. That may be your issue.

It didn't like that I'm afraid.

.../dev/grand-stack/api/build/index.js:33
  encrypted: development ? "ENCRYPTION_OFF" : "ENCRYPTION_ON"
             ^
ReferenceError: development is not defined

Do I need to update other packages by any chance?

Development is a local environment variable for me. You'll just need to pass encrypted as on, so:

const driver = neo4j.driver(
    neo4jURI,
    neo4j.auth.basic(
        neo4jUser,
        neo4jPassword
    ),
    {
        encrypted: "ENCRYPTION_ON"
    }
);

For local development I didn't need encrypted set to true for my aura instance I did.

I made the change. The Neo4j browser runs, and the GraphQL server starts without errors.

My app and the Playground both return:

"extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "code": "ServiceUnavailable",
          "name": "Neo4jError",
          "stacktrace": [
            "Neo4jError: socket hang up",

Can you post the code you're using to create your driver, server, etc? A github link something like that would help.

Here is index.js

import { ApolloServer } from "apollo-server-express";
import { typeDefs, resolvers } from "./graphql-schema";
import express from "express";
import { v1 as neo4j } from "neo4j-driver";
import { makeAugmentedSchema } from "neo4j-graphql-js";
import dotenv from "dotenv";

dotenv.config();

const app = express();

const schema = makeAugmentedSchema({
	typeDefs,
	resolvers,
});

const driver = neo4j.driver(
	process.env.NEO4J_URI || "bolt://localhost:7687",
	neo4j.auth.basic(
		process.env.NEO4J_USER || "neo4j",
		process.env.NEO4J_PASSWORD || "test"
	),
	//added the following for neo4j v4.1 July 2020
	{
		encrypted: "ENCRYPTION_ON"
	}
);

const server = new ApolloServer({
	context: { driver },
	schema: schema,
	introspection: true,
	playground: true
});

const port = process.env.GRAPHQL_LISTEN_PORT || 4001;
const path = "/graphql";

server.applyMiddleware({app, path});

app.listen({port, path}, () => {
	console.log(`GraphQL server ready at http://localhost:${port}${path}`);
});