I am trying to start my nestJs server and It keeps giving me this error:
UnhandledPromiseRejectionWarning: Error: You must await server.start()
before calling server.applyMiddleware()
at ApolloServer
I'm not even sure where to debug from as I am still very new at NestJs and GraphQL.
This is a known bug with an open issue and a merged PR to fix it. For now, you can downgrade to apollo-server-express@^2
I faced this issue when upgrading Ben Awad's Graphql-Next-Typeorm[...] stack, simply adding an await to server start fixed the warnings
const apolloServer = new ApolloServer({ introspection: true, schema: await buildSchema({ resolvers: [__dirname + '/resolvers/**/*.js'], validate: false }), context: ({ req, res }) => ({ req, res, redis: redisClient }), formatError }); // added this line await apolloServer.start(); apolloServer.applyMiddleware({ app, cors: false });
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With