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
Upgrading from v0.2 to v0.3 and I found my swagger 2.0 path expansion no longer works.
paths:
"/my/images/{resource+}":
In version 2.0, this allowed me to expand that parameter to any path. So /my/images/foo/bar/img.png would yield a event.pathParameters.resource equal to foo/bar/img.png. This no longer works with this error being show.
Again, I have used this in AWS API Gateway with v0.2.x as others have noted (OAI/OpenAPI-Specification#892 (comment)) can we allow this project to do what staging/production env can do locally for dev? This blocks my upgrade to 0.3.x.
apiGet:
Type: Api
Properties:
Path: /{version}/{service}/{path+}
Method: GET
RestApiId: !Ref ApiGateway
I receive:
Traceback (most recent call last):
File "/Users/vasmik/Library/Python/2.7/bin/sam", line 11, in <module>
sys.exit(cli())
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/click/core.py", line 722, in __call__
return self.main(*args, **kwargs)
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/click/decorators.py", line 64, in new_func
return ctx.invoke(f, obj, *args[1:], **kwargs)
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/samcli/commands/local/start_api/cli.py", line 56, in cli
docker_network, log_file, skip_pull_image, profile) # pragma: no cover
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/samcli/commands/local/start_api/cli.py", line 86, in do_cli
service.start()
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/samcli/commands/local/lib/local_api_service.py", line 72, in start
service.create()
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/samcli/local/apigw/service.py", line 81, in create
methods=api_gateway_route.methods)
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/flask/app.py", line 64, in wrapper_func
return f(self, *args, **kwargs)
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/flask/app.py", line 1046, in add_url_rule
self.url_map.add(rule)
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/werkzeug/routing.py", line 1215, in add
rule.bind(self)
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/werkzeug/routing.py", line 687, in bind
self.compile()
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/werkzeug/routing.py", line 740, in compile
_build_regex(self.is_leaf and self.rule or self.rule.rstrip('/'))
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/werkzeug/routing.py", line 715, in _build_regex
for converter, arguments, variable in parse_rule(rule):
File "/Users/vasmik/Library/Python/2.7/lib/python/site-packages/werkzeug/routing.py", line 210, in parse_rule
raise ValueError('malformed url rule: %r' % rule)
ValueError: malformed url rule: '/<version>/<service>/<path+>'
Turns out the code currently supports {proxy+} but not any other name instead of proxy. I have tagged it as a bug so we can fix. If you want a workaround, changing this the wildcard to word {proxy+} will solve.
Activity
metaskills commentedon Jun 2, 2018
Here is an example template.yaml that work in both v0.2 locally and when deployed to AWS.
metaskills commentedon Jun 2, 2018
Again, I have used this in AWS API Gateway with v0.2.x as others have noted (OAI/OpenAPI-Specification#892 (comment)) can we allow this project to do what staging/production env can do locally for dev? This blocks my upgrade to 0.3.x.
metaskills commentedon Jun 2, 2018
And I really wanted to upgrade to 0.3.0 for the binary data fixes to work locally.
vasmik commentedon Jun 6, 2018
I've faced with same issue
for
I receive:
sanathkr commentedon Jun 6, 2018
Turns out the code currently supports
{proxy+}but not any other name instead ofproxy. I have tagged it as a bug so we can fix. If you want a workaround, changing this the wildcard to word {proxy+} will solve.This code is implemented in one class here - https://github.com/awslabs/aws-sam-cli/blob/develop/samcli/local/apigw/path_converter.py. It is a fairly self-contained change to a few regexes to fix this bug. If you are interested in contributing, I will be happy to guide you through.
metaskills commentedon Jun 7, 2018
I can confirm using
{proxy+}as the name does provide a workaround. Thanks!jfuss commentedon Jul 17, 2018
Arbitrary names for path expansions has been released with v0.5.0
Closing as this is released