Doesn't work with netlify
They use APIGatewayProxyEvent.
"errorMessage":"Unable to determine event source based on event."
Not sure why this isn't detected.
Do you have an example app I can easily deploy?
https://github.com/richardanaya/netlify
npm install netlify-cli -g
npm install
npm run build
netlify dev
checkout http://localhost:8888/.netlify/functions/hello
It seems their event doesn't have a requestContext member.
If it helps I was able to get working with the alternate library serverless-http using these instructions: https://www.netlify.com/blog/2018/09/13/how-to-run-express.js-apps-with-netlify-functions/
I'm running into this same exact issue, at least in development with netlify dev, which keeps me from using Apollo v3.
Running locally with netlify dev seems to work if you monkey patch Netlify's event with the requestContext property:
import type { Handler } from "@netlify/functions";
import { ApolloServerPluginLandingPageGraphQLPlayground } from "apollo-server-core";
import { ApolloServer } from "apollo-server-lambda";
import typeDefs from "../typeDefs";
const server = new ApolloServer({
mocks: true,
// @ts-ignore
playground: true,
plugins: [ApolloServerPluginLandingPageGraphQLPlayground()],
typeDefs,
});
const apolloHandler = server.createHandler();
export const handler: Handler = (event: any, context: any, ...args) => {
return apolloHandler(
{
...event,
requestContext: context,
},
context,
...args
);
};