I've deployed below code to Cloud Functions to access a graph database(Neo4j Trial on GCP
)
import * as functions from 'firebase-functions';
import * as neo4j from 'neo4j-driver'
export const helloWorld = functions.https.onRequest((request, response) => {
const driver = neo4j.v1.driver("bolt://myaddress", neo4j.v1.auth.basic("username", "password"))
const session = driver.session()
session.run('CREATE (a:Person) SET a.name ={name} RETURN a', {name: 'Vinay'})
.then(result => {
console.log(result);
response.send(result)
session.close();
})
.catch(error => {
session.close();
console.log(error);
response.status(500).send(error)
});
driver.close()
});
when i call the url to access the function it gives the below error as Result
{"code":"ServiceUnavailable","name":"Neo4jError"}
this is the error shown on console when i run it locally
Neo4jError: Client network socket disconnected before secure TLS connection was established
>
> at captureStacktrace (c:\NodeFirebase\functions\node_modules\neo4j-driver\lib\v1\result.js:199:15)
> at new Result (c:\NodeFirebase\functions\node_modules\neo4j-driver\lib\v1\result.js:65:19)
> at Session._run (c:\NodeFirebase\functions\node_modules\neo4j-driver\lib\v1\session.js:152:14)
> at Session.run (c:\NodeFirebase\functions\node_modules\neo4j-driver\lib\v1\session.js:130:19)
> at exports.helloWorld.functions.https.onRequest (c:\NodeFirebase\functions\lib\index.js:11:13)
> at Run (C:\Users\vinay\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:591:20)
> at C:\Users\vinay\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:565:19
> at Generator.next (<anonymous>)
> at C:\Users\vinay\AppData\Roaming\npm\node_modules\firebase-tools\lib\emulator\functionsEmulatorRuntime.js:7:71
> at new Promise (<anonymous>) code: 'ServiceUnavailable', name: 'Neo4jError' }
What does it mean, how to solve this ?