Skip to content
Advertisement

Lambda path parameters are embedded inside path dictionary

I have some python AWS lambdas which are deployed using serverless framework and I was able to retrieve the path variables using:

event.get("variable")

I am not sure what has changed but now I need to retrieve these path parameters using:

event.get("path").get("variable")

I am using lambda integration and my serverless configuration has not changed and looks like:

JavaScript

I want to retrieve the id variable using event.get("id"), what do I need to do to remap the path parameters to be retrievable straight from the event?

Advertisement

Answer

I dont know if I was hallucinating but it doesnt seem as if what I was originally doing can ever work…

This is a solution although it is ugly, but posting here might help someone to understand what it is that I am trying to achieve, which is to get the path and request body into the event with nothing else:

JavaScript

It is not pretty and if there is a more simplistic way to do this then I would appreciate knowing the answer!

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement