Deploy: pathmapping - Invalid stage identifier specified.
See original GitHub issueThis is a Bug Report
Description
For bug reports:
- What went wrong? - pathmapping failed, invalid stage identifier
- What did you expect should have happened? - deployment
- What was the config you used?
Pathmapping section
pathmapping:
Type: AWS::ApiGateway::BasePathMapping
Properties:
BasePath: ${self:service}
DomainName: ${self:custom.domains.${opt:stage, self:provider.stage}}
RestApiId:
Ref: ApiGatewayRestApi
Stage: ${opt:stage}
Produces this in the serverless-state.json
"resources": {
"Resources": {
"pathmapping": {
"Type": "AWS::ApiGateway::BasePathMapping",
"Properties": {
"BasePath": "demolambda",
"DomainName": "staging-api.<REDACTED>",
"RestApiId": {
"Ref": "ApiGatewayRestApi"
},
"Stage": "staging"
}
}
}
- What stacktrace or error message from your provider did you see?
Verbose logging of CloudFormation process:
CloudFormation - CREATE_FAILED - AWS::ApiGateway::BasePathMapping - pathmapping
Ending error:
An error occurred while provisioning your stack: pathmapping - Invalid stage identifier specified.
Additional Data
- Serverless Framework Version you’re using: 1.17.0
- Operating System: Linux (Ubuntu 14.04)
- Stack Trace:
- Provider Error messages:
Issue Analytics
- State:
- Created 6 years ago
- Reactions:17
- Comments:25 (1 by maintainers)
Top Results From Across the Web
BasePathMapping deployment error: Invalid stage identifier ...
It tries to deploy the BasePathMapping before the ApiGateway Stage, which results in the error: Invalid stage identifier specified.
Read more >AWS CloudFormation: pathmapping - Invalid stage identifier ...
when I ran the stack, I kept my deployed API stageName same as the BasePathMapping stageName and able to successfully create the Mapping....
Read more >Attempting a custom mapping for ApiGateway
I'm attempting to do a base path mapping based on stage. ... provisioning your stack: APIDomainMapping - Invalid stage identifier specified.
Read more >The template had one minor issue i.e Stage resource needs to ...
Invalid stage identifier specified (Service: AmazonApiGateway; Status Code: 400; ... Had to add AWS::ApiGateway::Deployment dependency in ...
Read more >AWS::ApiGateway::BasePathMapping - AWS CloudFormation
The AWS::ApiGateway::BasePathMapping resource creates a base path that clients who call your API must use in the invocation URL.
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Closing since this is an old issue and a
DependsOn
does the trick here.After some digging I figured out that the cause here was basically order of ops on the deploy. Since I was deploying a new stack APIGateway didn’t have a
staging
stage and it would try to run the pathmapping before the stage existed, henceInvalid Stage
.I saw a couple posts about adding a bogus
DependsOn
to force it to “wait” but that approach didn’t work so I was left doing 2 deploys; the first withoutpathmapping
in the config to get the stage and Lambda functions created, followed by a second (and then all subsequent deploys) wherepathmapping
is present and the stage exists.This doesn’t seem like a major issue since you can pretty easily get around it and once it’s fixed (and the stage exists) it doesn’t happen again, but would be nice to have a better way to get this working on new deploys.