-
-
Notifications
You must be signed in to change notification settings - Fork 798
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
event.resource
in catch-all route gets +
changed to *
#1431
Comments
thank you for reporting! I haven't looked into this yet, but one possibility you are experiencing this issue is that * is being used by |
I ran into this working on an api gateway adapter @Lilja created some event bodies comparing serverless offline to apigateway to verify this Api Gateway Rest Api
Serverless Offline
I think its related to this line here
Is this the fix const resource = this.#routeKey || route.path.replace(`/${this.#stage}`, '').replace('*','+') |
Hey @dnalborczyk if I made a PR with that fix do you think it would be merged? |
@Ankcorn that would be great. I don't see why not!? |
Bug Report
Context
With AWS, it's possible to define wildcard / "catch-all" routes using
/stuff/{wildcard+}
syntax in YML file:https://stackoverflow.com/questions/35773025/is-it-possible-to-use-wildcards-or-catch-all-paths-in-aws-api-gateway
Then path of the requested resource is available as
event.resource
in the handler.Problem
The value of
event.resource
is different underserverless
vsserverless-offline
:Expected:
/stuff/{wildcard+}
(matching YML entry; this is how serverless works)Actual:
/stuff/{wildcard*}
(serverless-offline converts+
to*
for some reason 🤔 )Sample Code
Versions
This is not new, has been happening for a while, but I didn't report it before as I wanted to update all versions first
serverless
version: 3.17.0 (happening with 2.x too)serverless-offline
version: 8.8.0 (happening with 7.x too)node.js
version: 14.19 or 16.15OS
: macOS 12.4The text was updated successfully, but these errors were encountered: