integration: lambda gives "Unable to determine event source based on event."
See original GitHub issueHi all,
When deploying using serverless
with serverless-api-gateway-caching
like so:
functions:
graphql:
handler: src/handler.graphqlHandler
events:
- http:
path: graphql
method: post
cors: true
integration: lambda
caching:
enabled: true
cacheKeyParameters:
- name: integration.request.header.bodyValue
mappedFrom: method.request.body
The event is structured like this:
{
body: {
...gql...
},
method: 'POST',
principalId: '',
stage: 'dev',
cognitoPoolClaims: { sub: '' },
enhancedAuthContext: {},
headers: {
Accept: '*/*',
'Accept-Encoding': 'gzip, deflate, br',
'Accept-Language': 'en-GB,en;q=0.5',
'cache-control': 'no-cache',
'CloudFront-Forwarded-Proto': 'https',
'CloudFront-Is-Desktop-Viewer': 'true',
'CloudFront-Is-Mobile-Viewer': 'false',
'CloudFront-Is-SmartTV-Viewer': 'false',
'CloudFront-Is-Tablet-Viewer': 'false',
'CloudFront-Viewer-Country': 'GB',
'content-type': 'application/json',
dnt: '1',
Host: '...host url...',
origin: 'https://...origin url...',
pragma: 'no-cache',
Referer: 'https://...referrer url...',
'sec-gpc': '1',
'User-Agent': 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0',
Via: '2.0 xxxxxx.cloudfront.net (CloudFront)',
'X-Amz-Cf-Id': 'xxxxxx',
'X-Amzn-Trace-Id': 'Root=xxxxxx',
'X-Forwarded-For': '...some ips...',
'X-Forwarded-Port': '443',
'X-Forwarded-Proto': 'https'
},
query: {},
path: {},
identity: {
cognitoIdentityPoolId: '',
accountId: '',
cognitoIdentityId: '',
caller: '',
sourceIp: '...ip...',
principalOrgId: '',
accessKey: '',
cognitoAuthenticationType: '',
cognitoAuthenticationProvider: '',
userArn: '',
userAgent: 'Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:88.0) Gecko/20100101 Firefox/88.0',
user: ''
},
stageVariables: {},
requestPath: '/graphql'
}
It seems you cannot enable method.request.body
cacheKeyParameters
without integration: lambda
which seems to mess with the event
.
Should this be an event type we are able to handle or am I missing a setting to turn it in to an event that can be handled?
Issue Analytics
- State:
- Created 2 years ago
- Comments:11
Top Results From Across the Web
apollo-server-lambda: Unable to determine event source ...
Within serverless-express, in src/event-sources/utils.js, there is a function called getEventSourceNameBasedOnEvent(), which is throwing the ...
Read more >Unable to determine event source based on event. (apollo ...
I have this issue after updating to apollo-server-lambda@3^ “Error: Unable to determine event source based on event.” This code used to work ...
Read more >Using Lambda with Amazon SQS - AWS Documentation
Create an SQS queue to serve as an event source for your Lambda function. Then configure the queue to allow time for your...
Read more >REST API (API Gateway v1) - Serverless Framework
To create HTTP endpoints as Event sources for your AWS Lambda Functions, ... Use http for integrating with an HTTP back end, http-proxy...
Read more >Netlify, apollo-server-lambda, and Webpack walked into a bar…
requestContext and then we are clear to run graphqlHandler(event, context) . Without that fix you will see the error “Unable to determine event...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I had this problem with
serverless-plugin-warmup
, and i need to set my payload event like this:–> Now, it’s all working well 😃
Getting the same error when using @vendia/serverless-express via apollo-server-lambda on Vercel.