type;缺少类型' graphqlschema&#x27的属性。
我正在尝试将Apollo服务器作为打字条中的云函数启动,并希望在我的TypeDefs中使用@Cypher和@relationship Directives。
要使用这些指令,我正在使用“@neo4j/graphQl”:“^3.0.0”。
在为阿波罗服务器提供架构时,我会遇到错误。 GetSchema()返回承诺,但ApollServer期望类型GraphQl模式的模式。
const neoSchema = new Neo4jGraphQL({ typeDefs });
const server = new ApolloServer({
schema: neoSchema.getSchema(),
context: ({ req }) => ({
headers: req.headers,
req,
}),
});
exports.handler = server.createHandler();
如果有人可以在这里帮助我,真的会很感激。
I am trying to launch an Apollo Server as a cloud function in typescript and want to use @cypher and @relationship directives in my typeDefs.
To use these directives I am using "@neo4j/graphql": "^3.0.0".
I am getting errors while providing schema to the apollo server. getSchema() returns a Promise but ApollServer expects a schema of type GraphQL Schema.
const neoSchema = new Neo4jGraphQL({ typeDefs });
const server = new ApolloServer({
schema: neoSchema.getSchema(),
context: ({ req }) => ({
headers: req.headers,
req,
}),
});
exports.handler = server.createHandler();
Would really appreciate it if someone can help me out here.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Apollo服务器在此步骤中无法履行承诺,并且您无法进行顶级等待(除非您在Typescript.next上),因此您必须将其包装在另一个功能中。
危险:
如果您不记忆一下,请不要跳过这一点,您将在每个调用中创建一个新的处理程序,这会使您对文件描述符泄漏打开。这样做的症状是,您将开始获得所有内容(包括DNS查找)的超时,因此您将开始在代码中获得
Enotfound
错误。我已经为您的后代添加了评论:Apollo Server can't handle a promise at this step, and you can't do top-level awaits (unless you're on typescript.next), so you have to wrap this in another function.
DANGER: DON'T SKIP THIS BIT
If you don't memoize this, you'll create a new handler on every invocation, which opens you up to a file descriptor leak. The symptom of this is that you'll start getting timeouts for EVERYTHING (including DNS lookups), so you'll start getting
ENOTFOUND
errors in your code. I've added a comment for your future generations: