Skip to content
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

[apollo-server-lambda] Unable to determine event source based on event #6005

Closed
electerious opened this issue Jan 16, 2022 · 2 comments
Closed

Comments

@electerious
Copy link

I've recently upgrade from apollo-server-lambda v2.25.1 to v3.6.1 following the migration guide. Since then I'm getting the following error when sending requests to the GraphQL Endpoint that is hosted on Vercel.

[POST] /api
19:28:08:34
2022-01-09T18:28:10.719Z	2014d7ba-295d-4344-a94a-007608d4788b	ERROR	Invoke Error 	{"errorType":"Error","errorMessage":"Unable to determine event source based on event.","stack":["Error: Unable to determine event source based on event.","    at getEventSourceNameBasedOnEvent (/var/task/node_modules/@vendia/serverless-express/src/event-sources/utils.js:88:9)","    at proxy (/var/task/node_modules/@vendia/serverless-express/src/configure.js:38:51)","    at handler (/var/task/node_modules/@vendia/serverless-express/src/configure.js:99:12)","    at Object.handler (/var/task/node_modules/apollo-server-lambda/dist/ApolloServer.js:51:27)"]}

How I'm creating the apollo server:
https://github.com/electerious/Ackee/blob/develop/src/utils/createApolloServer.js
https://github.com/electerious/Ackee/blob/develop/src/serverless.js#L16

How I'm creating the handler:
https://github.com/electerious/Ackee/blob/develop/src/serverless.js#L30

Related:
CodeGenieApp/serverless-express#416

@glasser
Copy link
Member

glasser commented Jan 21, 2022

apollo-server-lambda is designed to be run on Lambda. Vercel is not Lambda, so I would not expect this to work. Does vercel have some sort of Lambda-compatible emulation environment?

In any case, if this is an environment that can be supported, the proper way to do this is in @vendia/serverless-express as you've found above. Apollo Server is no longer in the business of understanding the various Lambda HTTP hosting environments and formats at a deep level.

@electerious
Copy link
Author

Found a solution: https://stackoverflow.com/a/71629935/207704

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Apr 20, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants