Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Failed to find a stack XXX #596

Open
Morpheusse opened this issue Oct 24, 2023 · 8 comments
Open

Failed to find a stack XXX #596

Morpheusse opened this issue Oct 24, 2023 · 8 comments
Labels

Comments

@Morpheusse
Copy link

Morpheusse commented Oct 24, 2023

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 creating the Domain + Certificate with the CI and the deploy, I am getting Failed to find a stack XXX although everything seems fine on BOTH IOT Core, Route 53 and Certificate Manager

Command Run
SLS_DEBUG=* serverless create-cert --stage dev
SLS_DEBUG=* serverless create_domain --stage dev
serverless deploy --stage dev --verbose

Console Output

× Stack XXXXX failed to deploy (36s)
Environment: linux, node 16.20.2, framework 3.36.0 (local) 3.36.0v (global), plugin 7.1.0, SDK 4.4.0
Credentials: Local, environment variables
Docs:        docs.serverless.com
Support:     forum.serverless.com
Bugs:        github.com/serverless/serverless/issues
Error:
Error: Failed to find a stack XXXXX
    at CloudFormationWrapper.<anonymous> (/XXXXXX/node_modules/serverless-domain-manager/dist/src/aws/cloud-formation-wrapper.js:103:23)
    at Generator.next (<anonymous>)
    at fulfilled (/XXXX/node_modules/serverless-domain-manager/dist/src/aws/cloud-formation-wrapper.js:8:58)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
make: *** [Makefile:6: dev] Error 1
Cleaning up project directory and file based variables
00:00
ERROR: Job failed: command terminated 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:
  Domain:
    dev:
      fqdn: XXX.qa.XXXX.com
      token: xxxxxxxxx
      zone: qa.XXXX.com.
    uat:
      fqdn: XXX.demo.XXXX.com
      token: xxxxxxxxx
      zone: demo.XXXX.com.
    prod:
      fqdn: XXXXX.com
      token: XXXXXXXX.com
      zone: XXXXX.com.
  customDomain:
    domainName: ${self:custom.Domain.${opt:stage, 'dev'}.fqdn}
    stage: ${self:provider.stage}
    createRoute53Record: true
    endpointType: REGIONAL
    securityPolicy: tls_1_2
  customCertificate:
    certificateName: ${self:custom.Domain.${opt:stage, 'dev'}.fqdn}
    idempotencyToken: ${self:custom.Domain.${opt:stage, 'dev'}.token}
    hostedZoneNames: ${self:custom.Domain.${opt:stage, 'dev'}.zone}
    rewriteRecords: false
    region: eu-west-1

Versions

  • Domain Manager version(s): [7.1.2]
  • Node/npm version: [16.20.2]
  • Serverless Version: [3.36.0]
  • Lambda Code [Javascript]

Possible Solution
Unfortunnately None, but maybe related to this one closed: #587

Additional context/Screenshots
None

@Morpheusse Morpheusse added the bug label Oct 24, 2023
@rddimon
Copy link
Collaborator

rddimon commented Oct 25, 2023

Hi @Morpheusse
It looks like, from the error message, that is not the latest plugin version is used:

Environment: linux, node 16.20.2, framework 3.36.0 (local) 3.36.0v (global), plugin 7.1.0, SDK 4.4.0

plugin 7.1.0

@Morpheusse
Copy link
Author

Hi @rddimon

I think this version is the one from the Dahsboard PLugin in serverless -> https://www.npmjs.com/package/@serverless/dashboard-plugin

What's configred on my packages.json is

{
  "name": "XXXXX",
  "version": "1.0.0",
  "description": "",
  "scripts": {
    "test": "jest",
    "lint": "eslint . --ext .ts",
    "lint:fix": "eslint . --ext .ts --fix"
  },
  "author": "XXXXX",
  "license": "ISC",
  "dependencies": {
    "@aws-sdk/client-cognito-identity-provider": "3.433.0",
    "@aws-sdk/client-iot-data-plane": "3.433.0",
    "jsonwebtoken": "9.0.2",
    "kafkajs": "2.2.4",
    "protobufjs": "7.2.5",
    "protobufjs-cli": "~1.1.2",
    "zod": "3.22.4"
  },
  "devDependencies": {
    "@types/aws-lambda": "8.10.125",
    "@types/jest": "29.5.6",
    "@types/jsonwebtoken": "9.0.4",
    "@typescript-eslint/eslint-plugin": "6.8.0",
    "@typescript-eslint/parser": "6.8.0",
    "aws-sdk-mock": "5.8.0",
    "esbuild": "0.17.19",
    "eslint": "8.52.0",
    "jest": "29.7.0",
    "serverless-certificate-creator": "1.6.0",
    "serverless-domain-manager": "7.1.2",
    "serverless-esbuild": "1.48.5",
    "serverless-iam-roles-per-function": "3.2.0",
    "ts-jest": "29.1.1",
    "typescript": "5.2.2"
  }
}

@rddimon
Copy link
Collaborator

rddimon commented Oct 25, 2023

@Morpheusse
What is the result of the npx npm list command?

@NickParks
Copy link

NickParks commented Oct 30, 2023

Also running into this issue.

npx list:

npx npm list
backend@1.0.0 D:\backend
├── @clerk/clerk-sdk-node@4.12.5
├── @types/node@20.6.0
├── cookies@0.8.0
├── jsonwebtoken@9.0.2
├── prisma@5.2.0
├── serverless-domain-manager@7.1.2
├── serverless-middleware@3.2.0
├── serverless-offline@12.0.4
├── serverless-plugin-typescript@2.1.5
├── serverless-prune-plugin@2.0.2
├── ts-node@10.9.1
└── typescript@5.1.6

config:

customDomain:
   domainName: ${sls:stage}.x.x.com
   stage: ${sls:stage}
   apiType: rest
   certificateArn: "ARN for SSL"
   createRoute53Record: true
   endpointType: regional
   securityPolicy: tls_1_2
   autoDomain: true

Error:

Error:
Error: Failed to find a stack x-backend-dev
    at CloudFormationWrapper.<anonymous> (/backend/node_modules/serverless-domain-manager/dist/src/aws/cloud-formation-wrapper.js:103:23)
    at Generator.next (<anonymous>)
    at fulfilled (/backend/node_modules/serverless-domain-manager/dist/src/aws/cloud-formation-wrapper.js:8:58)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)

Also:
Environment: linux, node 18.18.0, framework 3.36.0 (local), plugin 7.1.0, SDK 4.4.0

I have 7.1.2 but it's reporting back 7.1.0.

@akfreas
Copy link

akfreas commented Nov 6, 2023

I had this issue and the problem in my case was a combination of poor error logging and developer error. I'm using apiType: http in my configuration. Here's the config:

customDomain:
    domainName: <domain>
    stage: $default
    certificateArn: <arn>
    endpointType: regional
    hostedZoneId: <id>
    apiType: http
    autoDomain: true

I had to proxy the request to Cloudformation to figure out that the error Failed to find a stack was hiding the underlying HTTP 400 error returned by Cloudformation:

<ErrorResponse xmlns="http://cloudformation.amazonaws.com/doc/2010-05-15/">
  <Error>
    <Type>Sender</Type>
    <Code>ValidationError</Code>
    <Message>Resource HttpApi does not exist for stack tangential-dev</Message>
  </Error>
  <RequestId>8319467e-7f99-4151-9410-4f0cfa5d858c</RequestId>
</ErrorResponse>

Indeed, there was no HttpApi resource. And that was because I was using http: in my serverless event rather than httpApi:. Here's the final change in my serverless.yml that finally worked:

functions:
  startWorkspaceAnalysis:
    handler: src/functions/startWorkspaceAnalysis.handler
    events:
      - httpApi:
          method: get
          path: /workspace/analyze

This created the necessary HttpApi that the plugin was looking for. Hope that helps someone!

@tyoc213
Copy link

tyoc213 commented Nov 21, 2023

@akfreas how did you trace that? (I mean you said poor logging)

Can you format a little your response? Im not sure if I need to add apiType: http on the custom section or that was the problem...

@akfreas
Copy link

akfreas commented Nov 21, 2023

@akfreas how did you trace that? (I mean you said poor logging)

Can you format a little your response? Im not sure if I need to add apiType: http on the custom section or that was the problem...

I modified the code in node_modules to proxy the request to Charles so I could see the error. Try the httpType I mentioned though, maybe that works?

@rddimon
Copy link
Collaborator

rddimon commented Feb 8, 2024

Hi @Morpheusse

Hope you are doing well and have already solved an issue.
In other case place try our latest version v7.3.5 and let us know the result

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants