Hi @Yongjoon_Kim, and welcome to the community!
That doesn’t seem to be your problem. The event payload seems properly configured.
Unfortunately, Zapier is concealing many of the API details. In the future, I would recommend you hop over to Autocode which is like Heroku + Zapier and would allow you to prototype your API with a little more transparency and certainly ease of testing.
I would try this change, but note that depending on your Lamda service configuration, this may not be the entire resolution to your issue. But given the reference to await response.json()
you are expecting the response to be parseable JSON data so I would add the Accept
directive while also setting Content-Type
to lower case (it matters).
let response = await fetch(awsUrl, {
method: "POST",
body: JSON.stringify(event),
headers: {
"Accept": "application/json",
"content-type": "application/json",
}
});
You may also want to experiment by managing the call into Lambda as a Promise(). Something like…
async function callMyPythonService(postURL, postOptions) {
await fetch(postURL, postOptions)
.then((resp) => resp.json())
.then(function(data) {
return data;
})
.catch(function(e) {
output.markdown(e.message);
});
}
Hi @Bill.French,
Thank you so much for your comments! Actually, your first suggestion was really helpful. I was able to solve this problem by
- Including the “Accept” header that you mentioned
- Setting up proper query string parameters in ‘Method Request’ and ‘Integration Request’ in my API Gateway that is connected to my Lambda function
Due to the structural difference between the payload in Zapier’s Lambda trigger and the payload from the API Gateway, I had to duplicate my existing Lambda function with a small tweak about receiving the input event, but that was it.
I’m super happy to solve this issue with your advice! It really made my day! Hope I can contribute to this community in the future.
Hi @Bill.French,
Thank you so much for your comments! Actually, your first suggestion was really helpful. I was able to solve this problem by
- Including the “Accept” header that you mentioned
- Setting up proper query string parameters in ‘Method Request’ and ‘Integration Request’ in my API Gateway that is connected to my Lambda function
Due to the structural difference between the payload in Zapier’s Lambda trigger and the payload from the API Gateway, I had to duplicate my existing Lambda function with a small tweak about receiving the input event, but that was it.
I’m super happy to solve this issue with your advice! It really made my day! Hope I can contribute to this community in the future.
You’re welcome! Now go break something else so we can all learn some more. :winking_face: