You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
It is possible to extract variables from path when using sam local start-api but not all supported cases are valid for deployment to AWS API Gateway.
Steps to reproduce
Create lambda and SAM template to be triggered by path with variables:
TheFunction:
Type: AWS::Serverless::Function
Properties:
CodeUri: .
Handler: app.lambdaHandler
Runtime: nodejs8.10
Events:
Aliases:
Type: Api
Properties:
Path: /{product}/prefix_{type}_suffix/{id}.json
Method: get
Start local API and invoke URL http://127.0.0.1:3000/good-stuff/prefix_type_A_suffix/123.json
You can see that path parameters were successfully parsed:
But when trying to deploy such template to API Gateway you will get error Resource's path part only allow a-zA-Z0-9._- and curly braces at the beginning and the end.
Observed result
All works fine!
Expected result
I'd expect SAM CLI to tell me that such format is not supported.
As a workaround, you have to define path like /{product}/{param_with_type}/{id_with_extension} and parse variables out of path parameters, or just setup proxy integration and parse path parts on you own (or by some framework which will do all the routing for you), which is fine as such path variables are not supported in AWS API Gateway now, as far as I know.
Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
OS: Windows
sam --version: SAM CLI, version 0.11.0
The text was updated successfully, but these errors were encountered:
It is a a year later but I get the same error about the path when deploying a SAM template that includes "Path: "/users/{+proxy}"". Is this not possible?
Description
It is possible to extract variables from path when using
sam local start-api
but not all supported cases are valid for deployment to AWS API Gateway.Steps to reproduce
Create lambda and SAM template to be triggered by path with variables:
Start local API and invoke URL
http://127.0.0.1:3000/good-stuff/prefix_type_A_suffix/123.json
You can see that path parameters were successfully parsed:
But when trying to deploy such template to API Gateway you will get error
Resource's path part only allow a-zA-Z0-9._- and curly braces at the beginning and the end.
Observed result
All works fine!
Expected result
I'd expect SAM CLI to tell me that such format is not supported.
As a workaround, you have to define path like
/{product}/{param_with_type}/{id_with_extension}
and parse variables out of path parameters, or just setup proxy integration and parse path parts on you own (or by some framework which will do all the routing for you), which is fine as such path variables are not supported in AWS API Gateway now, as far as I know.Additional environment details (Ex: Windows, Mac, Amazon Linux etc)
sam --version
: SAM CLI, version 0.11.0The text was updated successfully, but these errors were encountered: