My Architecture:
- AWS HTTP API w/ reverse proxy integration
- Plain Lambda function
- Postman or browser
I'm trying to check the request method to handle actions, based on this answer they recomm
'use strict';
const AWS = require('aws-sdk');
const dynamo = new AWS.DynamoDB.DocumentClient();
exports.handler = async (event) => {
switch (event.httpMethod) {
case 'GET':
break;
default:
throw new Error(`@@@@ Unsupported method "${event.httpMethod}"`);
}
return {
statusCode: 200,
body: JSON.stringify({message: 'Success'})
};
};
I pasted that code just like that in my lambda and it doesn't work, I get this error in the logs:
"errorMessage": "@@@@ Unsupported method "undefined"",
That lambda is triggered by my HTTP API and the route has GET method.
If I return the event, I can see that the method is GET or POST, or whatever, look:
Anyone has any idea what's going on?
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…