CodeGenieApp / CodeGenieApp/serverless-express

API Gateway with custom domain and base path returns 404

Open
#397 0 comments 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.3k
Forks
676
PR merge metrics
No merged PRs in 30d

Description

Upgrading from version 3.x to 4.x (Using Koa framework)

Api Gateway + custom domain + base path `job`

Event is coming as :
```
{
"resource": "/{proxy+}",
"path": "/job/status",
...
"pathParameters": {
"proxy": "status"
}
...
}
```
It seems `pathParameters.proxy` value is taken and `ctx.url` is set to `/job` instead of `/job/status` which ends up with 404.

@brett-vendia Is this somehow related to - https://github.com/vendia/serverless-express/blob/4b5ca7a5e90c7709b25b8fada30e13a76ed5c651/src/event-sources/utils.js#L8

Is there any way this stripBasePath to be configurable ?

Contributor guide

Open the contributing guide

Research direction

Start with src/event-sources/utils.js at the referenced line and trace how pathParameters.proxy is used when building the Koa request URL. Reproduce the supplied API Gateway event with custom domain base path `job`; done means the `/job/status` request no longer returns 404 and the base-path stripping behavior can be configured as requested.

Written by the indexing model from the issue text.

Assessment

Tech stack
aws, javascript, node.js
Domain
api, backend, cloud
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.