Open TreeMan360 opened 3 years ago
Looking at the synchronous approach taken here: https://github.com/serverless-components/express/blob/master/src/_express/handler.js
I don't see this being a possibility without a PR / fork.
I am currently got the same case. I'd like to perform async setup before returning app. I am also thinking to fork and to add required logic. Maybe this: https://github.com/dougmoscrop/serverless-http/blob/f72fdeaa0d25844257e01ff1078585a92752f53a/serverless-http.js#L14 could be resolved asynchronously. It could be enough just to move that line into async handler. But then I have some doubts on how to use updated version of serverless-http
?
Same issue here. Any workaround?
Hi,
I am trying to correctly boostrap the lambda so that it waits until the server is ready. I am using
apollo-server-express
to host a GraphQL endpoint.With an
app.ts
similar to:This works but obviously when there is a cold start the lambda is not initially ready as
startApolloServer
has not completed.I need to
await startApolloServer()
during module initialisation. Everything I have tried has not achieved the desired result. What is the recommended best practice in this scenario?Thanks, Mark