Unable to update base path mapping
varad11 opened this issue · 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
Bug Report
Error Description
An error displayed telling V2 base path mapping update failed for my custom domain.
But I have actually configured HTTP(V1) api instead of REST(V2),
Command Run
sls deploy
Console Output
Error:
Error: V2 - Unable to update base path mapping for 'prefix.mydomain.com':
Invalid stage identifier specified
at APIGatewayV2Wrapper.<anonymous> (/usr/local/lib/node_modules/serverless-domain-manager/dist/src/aws/api-gateway-v2-wrapper.js:163:23)
at Generator.throw (<anonymous>)
at rejected (/usr/local/lib/node_modules/serverless-domain-manager/dist/src/aws/api-gateway-v2-wrapper.js:6:65)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
Domain Manager Configuration
Replace this with your own serverless.yml
file (anonymized, of course) to help us better resolve your issue.
custom:
customDomain:
domainName: 'prefix.mydomain.com'
basePath: ''
certificateName: 'mydomain.com'
createRoute53Record: true
stage: 'production'
endpointType: 'regional'
apiType: http
autoDomain: true
Versions
- Domain Manager version(s): v7.3.3
- Node/npm version: Node 14/npm 6
- Serverless Version: v3.26.0
- Lambda Code: Javascript
Possible Solution
Additional context/Screenshots
I am using aws/codebuild/standard:6.0 Linux EC2
A workaround temporarily is to revert back to an older serverless-domain-manager version 6.4.4
Hi @varad11
Could you please also provide a function configuration?
Note:
The quick fix for your case will be changing the customDomain.stage
to $default
.
It looks like not a good solution but I'm not quite sure what should be the right solution based on the next article:
https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-stages.html
It looks like we should always have $default
stage before deploying anyone else
I ran into this as well during a migration from gitlab to github for CI. We do not use a $default
stage and would prefer not to have one. Rolling back to 6.4.4 was a viable workaround, but I think if we can deploy successfully to aws using an earlier version with no $default
stage, that indicates an issue with the plugin rather than a missing AWS requirement. Maybe I'm misreading this line though You can create a $default stage that is served from the base of your API's URL—for example, https://{api_id}.execute-api.{region}.amazonaws.com/. You use this URL to invoke an API stage.
tbh, we don't much care about the stage at all for apigateway as our environments are logically separated by accounts/vpcs and we are never invoking api's from the amazonaws.com
endpoint, but I'd rather not have to add a dummy stage just to deploy.
Could you please try our latest version v7.3.5 ?
And provide us the result
@rddimon the latest version works without error for me. Thank you.
I've had the version pinned to 6.4.4
and must have missed this. I'm still seeing the issue on 7.3.5
:
Ă— Stack dev-proto-test-api failed to deploy (12s)
Error:
Error: V1 - Unable to fetch information about 'api.dev.my.endpoint.com':
Environment: linux, node 18.19.1, framework 3.38.0 (local) 3.37.0v (global), plugin 7.2.2, SDK 4.5.1
Credentials: Local, environment variables
Docs: docs.serverless.com
Support: forum.serverless.com
Bugs: github.com/serverless/serverless/issues
The security token included in the request is invalid.
at APIGatewayV1Wrapper.<anonymous> (/__w/dev-proto-test-api/dev-proto-test-api/node_modules/serverless-domain-manager/dist/src/aws/api-gateway-v1-wrapper.js:77:27)
at Generator.throw (<anonymous>)
at rejected (/__w/dev-proto-test-api/dev-proto-test-api/node_modules/serverless-domain-manager/dist/src/aws/api-gateway-v1-wrapper.js:6:65)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Error: V1 - Unable to fetch information about 'api.dev.my.endpoint.com'
The security token included in the request is invalid.
Looks like there is an issue with your credentials and it's not related to the current issue Invalid stage identifier specified
Theres nothing wrong with the credentials being used, I rolled back package.json and package-lock.json to 6.4.4 and deployed the service with that version of the domain manager without issue. However, it does look like this may be an unrelated issue to this ticket. Let me know if you'd like me to spin off a fresh issue.
It looks like my implementation is using v1 of the wrapper as opposed to v2 as seen in varad's original ticket as well.
edit: created a new issue #621