Request Attributes and Containers #1237
Replies: 1 comment
-
How you get the path parameters depends on What type of function you're using. I assume you are using the FPM runtime, but are trying to get the parameters like you do with the Event-Based runtime. Here's more details. FPM Runtime ( Bref, sadly, does not pass along the path parameters from the API Gateway event. You can see how it converts the event to a FastCGI request here. You must using a router of some sort, or otherwise parse the URL yourself, just like if it was a standard web request. Event-Based Runtime ( Using a PSR-15 request handler you can access the parameters through the Hope that helps! |
Beta Was this translation helpful? Give feedback.
-
I have to use an AWS Lambda container for my code. The problem I'm having is getting my url attributes parsed out and into my Handler.
I have my url defined as this in serverless.yml:
http: "GET /client/{cid}/payment/{id}"
In my code that calls the Handler, I'm building a ServerRequest object and then pass it to my Handler:
But, when I parse out the attributes, I don't see cid nor id in the array:
$this->logger->info("attributes:" . print_r($request->getAttributes(), true));
Am I doing something wrong, or should I be doing this another way?
Beta Was this translation helpful? Give feedback.
All reactions