Head's Up! These forums are read-only. All users and content have migrated. Please join us at community.neo4j.com.
11-12-2020 09:21 AM
Hi,
we're trying to use the assertSchema
function to add constraints in our Neo4j database with an apollo server running in a lambda with the library apollo-server-lambda
.
Without calling this function the graphql API works perfectly. But adding this call makes the lambda throw a timeout, even if we increase the timeout limit to 60 seconds.
The code looks like:
const {
typeDefs,
resolvers,
addListDependencies,
} = require("./graphql-schema");
const { ApolloServer } = require("apollo-server-lambda");
const { v1: neo4j } = require("neo4j-driver");
const { makeAugmentedSchema, assertSchema } = require("neo4j-graphql-js");
const {
mapDefinitions,
} = require("../../node_modules/neo4j-graphql-js/dist/augment/augment.js");
const { parse } = require("graphql");
const dotenv = require("dotenv");
dotenv.config();
const parsedDefs = parse(typeDefs);
const mapped = mapDefinitions({ definitions: parsedDefs.definitions });
const typeMap = mapped[0];
const { typeDefs: newTypeDefs, resolvers: newResolvers } = addListDependencies(
typeDefs,
resolvers,
typeMap
);
const augmentedSchema = makeAugmentedSchema({
typeDefs: newTypeDefs,
resolvers: newResolvers,
config: {
experimental: true,
},
});
const driver = neo4j.driver(
process.env.NEO4J_URI || "bolt://localhost:7687",
neo4j.auth.basic(
process.env.NEO4J_USER || "neo4j",
process.env.NEO4J_PASSWORD || "neo4j"
)
);
assertSchema({ augmentedSchema, driver, debug: true }); // this call makes the lambda throw a timeout
const server = new ApolloServer({
context: { driver },
schema: augmentedSchema,
});
exports.graphql = server.createHandler({
cors: {
origin: true,
credentials: true,
},
});
Before the timeout the logs show a print of the assertSchema in debug mode:
┌─────────┐
│ (index) │
├─────────┤
└─────────┘
We don't have any clue why this is happening, does anyone has an idea or at least a suggestion of where to look?
EDIT:
The version of both libraries are:
neo4j-graphql-js: 2.16.4
apollo-server-lambda: 2.18.2
Thank you in advance.
All the sessions of the conference are now available online