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
sls offline start --noPrependStageInUrl --prefix me --httpPort 3010
serverless.yml:
events:
- http:
method: getpath: '/'# changing to '' does not make a difference, but '/{proxy+}' and '{proxy+}' seem to be effective workarounds
Output from serverless-offline:
GET | http://localhost:3010/me/ │
POST | http://localhost:3010/2015-03-31/functions/summary/invocations
Response when trying to access http://localhost:3010/me:
{"currentRoute":"get - /me","error":"Serverless-offline: route not found.","existingRoutes":["get - /me/"],"statusCode":404}
Expected behavior/code
Request to http://localhost:3010/me should not be rejected by serverless-offline with a 404 response. And this expectation is consistent with the behaviour of AWS.
Environment
serverless version: 3.23.0
serverless-offline version: 11.1.3
node.js version: 14.19.3
OS: macOS 12.6
Additional information*
In the old versions, serverless-offline is not that strict about trailing slash - if you can access http://localhost:3000/me then you can access http://localhost:3000/me/ and vice versa.
Behaviour in version 8: accessing both with and without trailing slash would be successful, and this is consistent with AWS
Behaviour in version 11: accessing with trailing slash would be successful, accessing without trailing slash would fail, and this is not consistent with AWS
Just saw this:
[11.1.0] (2022-10-09)
Features
remove noStripTrailingSlashInUrl option ([71ee21d])
Maintenance Improvements
remove stripTrailingSlash from hapi config ([22fd667])
I am curious, was it intentional to remove the support of accessing endpoint without trailing slash?
The text was updated successfully, but these errors were encountered:
I removed the noStripTrailingSlashInUrl flag as you noticed in v11.1.0, and added the expected functionality without setting the flag. as you mentioned, serverless-offline should behave the same as aws. that said, I might have missed your scenario, or didn't fully understand the use case for such a flag.
I'll try to look into this soon. labeling as a bug in the meantime.
Bug Report
Current Behavior
Command line:
serverless.yml:
Output from serverless-offline:
Response when trying to access
http://localhost:3010/me
:Expected behavior/code
Request to
http://localhost:3010/me
should not be rejected by serverless-offline with a 404 response. And this expectation is consistent with the behaviour of AWS.Environment
serverless
version: 3.23.0serverless-offline
version: 11.1.3node.js
version: 14.19.3OS
: macOS 12.6Additional information*
In the old versions,
serverless-offline
is not that strict about trailing slash - if you can accesshttp://localhost:3000/me
then you can accesshttp://localhost:3000/me/
and vice versa.Just saw this:
I am curious, was it intentional to remove the support of accessing endpoint without trailing slash?
The text was updated successfully, but these errors were encountered: