Error: Failed to find a stack xxx
erolabzait opened this issue · comments
Bug Report
Hello,
I am currently encountering an issue when attempting to deploy an API service that exports an api gateway for other services to use.
Something similar to: https://github.com/GorillaStack/splitstack-postsapi but for the HTTP Api (V2)
Command Run
I use the latest version of the plugin.
sls deploy
Console Output
Error: Failed to find a stack xxx
at CloudFormationWrapper.<anonymous> (.../xxx/services/api/node_modules/serverless-domain-manager/dist/src/aws/cloud-formation-wrapper.js:103:23)
at Generator.next (<anonymous>)
at fulfilled (.../xxx/services/api/node_modules/serverless-domain-manager/dist/src/aws/cloud-formation-wrapper.js:8:58)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Best regards,
Hello again,
I was able to fix it. I was defining an api gateway with resource 'StoreApiGateway'.
Resources:
StoreApiGateway:
Type: AWS::ApiGatewayV2::Api
Properties:
Name: '${self:service}-${sls:stage}'
ProtocolType: HTTP
CorsConfiguration:
It seems that the plugin is searching for one of this 3 values HttpApi
| ApiGatewayRestApi
| WebsocketsApi
in the cloudformation output. You can find more details here #222
// Cloud Formation Resource Ids
public static CFResourceIds = {
[Globals.apiTypes.http]: "HttpApi",
[Globals.apiTypes.rest]: "ApiGatewayRestApi",
[Globals.apiTypes.websocket]: "WebsocketsApi",
};
So i had to rename StoreApiGateway
→ HttpApi
, this means it will create a new api (with a new api id) when you deploy 💔
Resources:
HttpApi:
Type: AWS::ApiGatewayV2::Api
Properties:
Name: '${self:service}-${sls:stage}'
ProtocolType: HTTP
CorsConfiguration:
It will be nice to have an option to set a different name then HttpApi
.
Something like:
custom:
customDomain:
domainName: serverless.foo.com
stage: ci
...
customCFIdentifier: 'StoreApiGateway'
Thanks for this awesome plugin,
👍