serverless-domain-manager icon indicating copy to clipboard operation
serverless-domain-manager copied to clipboard

Validate Function Paths Don't Overlap API GW Reserved Paths

Open bforbis opened this issue 4 years ago • 2 comments

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or "me too" comments, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

Feature Request

Is your feature request related to a problem? Please describe. The /ping and /sping paths are reserved paths on API Gateway. When using deployment stages, these generally don't overlap with deployed services. However, if you are not using basePathMappings, it is possible that the API Gateway paths will overwrite the lambda service paths.

Describe the solution you'd like The plugin could validate each of the functions in serverless.yml and make sure none of them use a path that is normally reserved for API Gateway. This would only be needed if customDomain.basePath is set to ''

bforbis avatar May 09 '20 00:05 bforbis

Is there an official list somewhere of AWS reserved paths?

I supposed it could warn, but doesn't it fail anyway on deploy?

tehnrd avatar May 13 '20 00:05 tehnrd

They are documented in API Gateway Known Issues. So far (and probably for the foreseeable future), this is only for ping and sping.

This does not fail the deployment, however if you hit these paths in your API Gateway using custom domains, it will hit the API Gateway endpoint instead of your application's endpoint. This can cause a lot of confusion if you didn't know that these root paths were reserved.

I ran into this issue with my own lambda service, where I defined a /ping that returned pong. However, when I ran it using customDomains, it curiously returned healthy.

bforbis avatar May 13 '20 16:05 bforbis