aws-sam-cli icon indicating copy to clipboard operation
aws-sam-cli copied to clipboard

pathParameter in in the resource string?

Open CodeVelo opened this issue 9 years ago • 5 comments

I think I'm seeing a discrepancy between the request object using sam and the API Gateway.

On my local machine I have a Java class that implements RequestStreamHandler. When I write out the inputStream I receive this:

"httpMethod":"GET","resource":"/programs/1","pathParameters":{"program_id":"1"}

However, when looking at the same request on the API Gateway I see this:

endpoint request body after transformations: {"resource":"/programs/{program_id}","path":"/programs/1","httpMethod":"GET","pathParameters":{"program_id":"1"}

Should the resource string contain the value of the pathParameter or the name of the pathParameter?

CodeVelo avatar Sep 28 '17 20:09 CodeVelo

I tested this out using node.js as well. It looks like the same issue happens with that runtime.

api-gateway.txt sam.txt

CodeVelo avatar Sep 28 '17 22:09 CodeVelo

I'm not sure what the right behavior is, but the missing name of the pathParameter can be explained by the lack of Swagger support in the CLI.

resios avatar Sep 29 '17 13:09 resios

Same problem here! I need the parameter name but the value is returned. API Gateway works well with parameter name.

Path and Resource are equals on SAM local. Take a look: image

lucasortigoso avatar Oct 08 '17 00:10 lucasortigoso

Same problem here!! any proceed?

xkguq007 avatar Jan 28 '18 09:01 xkguq007

Can you try the latest release - https://github.com/awslabs/aws-sam-cli/releases/tag/v0.3.0? I believe this is fixed. Feel free to re-open Issue if not.

sanathkr avatar May 08 '18 23:05 sanathkr