Closed matttm closed 3 months ago
I am also receiving null as a response from my aws lambda. The express app is not returning null.
Yes, I am also experiencing this. Express app works fine locally, but routes return null
when deployed
It happened to me, too. When I switch from nodejs16.x
to nodejs18.x
guys, this is still an issue i am facing I checked the logs, my express code is running as i can see logs for the lambda function but api gateway just returns 200 status code with null, no matter what my lambda does
versions:
"serverless-http": "^3.2.0",
"express": "^4.18.2",
"node": "20.6.1",
is there anything I can do to help?
Fixed this!!
@matttm you need to return the res from your handler.
doing context.res = tmp
doesn't cut it.
you need to return tmp
cc @whenmoon
module.exports.handler = async (context, req) => {
const tmp = await handler(context, req);
console.log('tmp', tmp);
// context.res = tmp;
return tmp
}
I am just trying to run express on a lambda and I keep getting null returned.
Do I need an API gateway for this to work?
Lambda code
Test event logs
dependencies