-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ApolloServer from async
function
#172
Comments
Dug around in the codebase and tried calling the export const handler = async (event, context, callback) => {
const config = {
telemetryLogger: new TelemetryConsoleLogger(),
};
const graphqlServer = await new BffGraphqlServer().getServer(config);
return startServerAndCreateLambdaHandler(graphqlServer, handlers.createAPIGatewayProxyEventV2RequestHandler())(event, context, callback);
}; That at least built successfully! I got a
Not sure if that's because I'm using it in a weird way or something else is wrong in my lambda setup (the Docker version we have with all the Apollo v4 code currently works perfectly, it's just the lambda having issues). |
Alright, took out the Regardless, it would be nice to have an example on this tool for what to do when you have an |
Hi there, I'm trying to upgrade to Apollo v4 and this lambda integration is the last piece that has me stumped.
Our Apollo server has to deal with a promise on the
schema
(we're stitching our local schema together with a remote one):Due to the
Promise
on building that server, for Apollo v3 we are set up like this:In an ideal v4 world using this plugin, I'd love to be able to pass a
Promise<ApolloServer>
directly into the main function:Or, that not being an option, have a way to manually create the handler, do my
await
, then call this server integration's code:My last-ditch item will be to enable top-level await on Node for the whole project so I could wait for the server to be created, but we're not in a great position to do that with the state of our codebase at the moment.
I'm hoping I'm simply overlooking something in the documentation, but if not, this would be a feature request to support async server creation.
Thanks in advance for the help!
The text was updated successfully, but these errors were encountered: