Not able to get an event from API Gateway in my Mockoon container #1432
-
I am not able to get the event coming from API Gateway I'm my current operation I want to get the API Gateway event and use a custom header to find the key to my S3 bucket. I have tried a lot of ways and all of them are failing on return. Steps to Reproduce
The response I get for this code with API Gateway
If I comment out the above and just use the one suggested in documentation it will work. Is there a good way for me to get the events and then execute the Mockoon Serverless application. Mockoon version: All Versions |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
I never tried using an async handler, but wouldn't this be enough? export const handler = async (event) => {
console.log("EVENT: " + event.headers['x-source-location']);
return mockoonServerless.awsHandler();
}; |
Beta Was this translation helpful? Give feedback.
-
Thanks @255kb for your response,
I think this might be a useful update to the documentation to add this block of code for people who want to use it. Happy to provide a MR with the changes. |
Beta Was this translation helpful? Give feedback.
-
Hi @255kb , |
Beta Was this translation helpful? Give feedback.
Thanks @255kb for your response,
Apologies I didn't return earlier.
The code suggested above didn't work for me. I think awsHandler() was having issues within Async block.
This workaround worked well though for me:
I think this might be a useful update to the documentation to add this block of code for people who want to use it. Happy to provide a MR with the changes.