serverless-domain-manager: Error: V2 - Unable to update base path mapping for '...': Invalid stage identifier specified

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 After upgrading from 7.0.4 to 7.1.0 I get the following output

Command Run

npx sls deploy --stage dev

Console Output


Deploying foo to stage dev (us-west-2)
Warning: Function (api) timeout setting (30) may not provide enough room to process an HTTP API request (of which timeout is limited to 30s). This may introduce a situation where endpoint times out for a successful lambda invocation.

Ă— Stack foo failed to deploy (252s)
Environment: linux, node 18.16.1, framework 3.33.0 (local), plugin 6.2.3, SDK 4.3.2
Credentials: Local, environment variables
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues

Error:
Error: V2 - Unable to update base path mapping for 'dev.example.com':
Invalid stage identifier specified
    at APIGatewayV2Wrapper.<anonymous> (/home/runner/work/.../node_modules/serverless-domain-manager/dist/src/aws/api-gateway-v2-wrapper.js:159:23)
    at Generator.throw (<anonymous>)
    at rejected (/home/runner/work/.../node_modules/serverless-domain-manager/dist/src/aws/api-gateway-v2-wrapper.js:6:65)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Error: Process completed with exit code 1.

Domain Manager Configuration Replace this with your own serverless.yml file (anonymized, of course) to help us better resolve your issue.

custom:
  stage: ${opt:stage, self:provider.stage}
  domains:
    dev: dev.example.com
    test: test.example.com
    prod: example.com
  customDomain:
    domainName: ${self:custom.domains.${self:custom.stage}}
    basePath: ''
    stage: ${self:custom.stage}
    createRoute53Record: true
    apiType: http
    endpointType: 'regional'

Versions

  • Domain Manager version(s): 7.1.0
  • Node/npm version: Node 18
  • Serverless Version: 3.33.0
  • Lambda Code: Javascript

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 2
  • Comments: 15

Most upvoted comments

Hi @jsw

Is the issue solved for you now? Are we good to close the issue?

I have confirmed that removing custom.customDomain.stage fixes the issue. I have tested multiple stages. Thanks for the solution.

Hi @zoli-kasa

It was a bit tricky release as it was a bug fix for the #578.

This issue is related only to the HTTP API type and not to the REST or Websocket. Also, this is an AWS behavior to not allow to create a custom stage without $default for the HTTP API type. One more thing is that the plugin will set $default stage for you in case not specified in the config.

But in general, the concern is right and we will take it into account in our further releases.

I am seeing this error - was it supposed to be resolved in the latest update? I just updated to v7.1.1 today and started seeing this issue. Will try the fix above but curious if there is something else I need to do. Thanks!

Upgrading to v7.1.1 and setting the customDomain.stage to $default works! Here’s an example snippet:

  customDomain:
    domainName: ${env:DOMAIN, ''}
    stage: $default
    basePath: v3/loans
    apiType: http
    endpointType: regional

I second this issue, and I can confirm that setting customDomain.stage to $default helps overcome this error.

However it’ll only deploy to our stg environment, it fails to deploy afterwards to prod. This is the error received on an attempt to deploy to prod (using $default):

Error:
UPDATE_ROLLBACK_IN_PROGRESS: loans-v3-*** (AWS::CloudFormation::Stack)
Export with name sls-loans-v3-default-DistributionDomainNameHttp is already exported by stack loans-v3-staging

Thank you for highlighting it! We are going to release a fix for it today.

I second this issue, and I can confirm that setting customDomain.stage to $default helps overcome this error.

However it’ll only deploy to our stg environment, it fails to deploy afterwards to prod. This is the error received on an attempt to deploy to prod (using $default):

Error:
UPDATE_ROLLBACK_IN_PROGRESS: loans-v3-*** (AWS::CloudFormation::Stack)
Export with name sls-loans-v3-default-DistributionDomainNameHttp is already exported by stack loans-v3-staging

Hi @jsw

Please set the customDomain.stage to the $default or just remove the stage option and the plugin will set it to $default

More info is here: https://docs.aws.amazon.com/apigateway/latest/developerguide/http-api-stages.html

maybe you could write a detailed change about this in the release log, to help other users with the same issue during upgrade?

maybe this should’ve been a major change, if the API is not compatible with the previous one?

Thank you for the response @belferink1996! Our issue ended up being another result of updating with the aws sdk. I can confirm that the $default stage with version 7.1.1 does work.

Thanks!