Hi folks, there are a few other posts that mention similar issues, but having tried numerous variations of solutions, I still can’t get this working.
I am calling a Netlify function via POST from a separate AWS Lambda function (not part of my Netlify project). When I run netlify dev
locally and route my POST to my local dev server via ngrok
, things work as expected: my Netlify function receives the POST request, and it returns to the aws lambda function without issue.
However, when I deploy to Netlify and do the same thing: 1) My Netlify function receives the POST request without error (as verified via function logs), but 2) My aws lambda function receives a response of error decoding lambda response: invalid status code returned from lambda: 0
from my Netlify function.
I would very much appreciate help resolving this!
Here is the function code in its present form (though I’ve tried numerous variations of return values based on other forum questions to no avail):
(fwiw current endpoint of this function is https://boring-varahamihira-cc7a90.netlify.app/.netlify/functions/completedTranscriptionCallback ):
exports.handler = (event, context) => {
console.log('completedTranscriptionCallback');
console.log(event);
console.log(context);
let responseBody = {
message: "Body test",
input: "An input!"
};
let response = {
statusCode: 200,
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(responseBody)
};
console.log("response: ", JSON.stringify(response))
return response;
}
As mentioned, if I route this to my local dev environment via e.g. ngrok
my aws lambda function is able to call it without error and receives the proper response body. It’s only once I deploy to Netlify that the error is returned and logged in lambda.
Thanks! Happy to provide additional info as needed.