amplify-education / serverless-domain-manager

Serverless plugin for managing custom domains with API Gateways.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

regression following latest update

yeyeric opened this issue · comments

Hello,

my CICD has always been working great and from yesterday I have an error.

Nothing changed in my CICD nor my code it was just a minor code update unrelated.

Looks like it's due to serverless-domain-manager, see logs:

serverless deploy --stage $CI_COMMIT_REF_NAME --verbose
To ensure safe major version upgrades ensure "frameworkVersion" setting in service configuration (recommended setup: "frameworkVersion: ^3.27.0")
Deploying main-app to stage staging (eu-west-3)
Excluding development dependencies for service package
Warning: Function main has timeout of 900 seconds, however, it's attached to API Gateway so it's automatically limited to 30 seconds.
Uploading CloudFormation file to S3
Uploading State file to S3
Uploading service main-app.zip file to S3 (480.4 kB)
Creating new change set
Waiting for new change set to be created
Change Set did not reach desired state, retrying
Change Set did not reach desired state, retrying
Executing created change set
  UPDATE_IN_PROGRESS - AWS::CloudFormation::Stack - main-app-staging
  UPDATE_IN_PROGRESS - AWS::Lambda::Function - MainLambdaFunction
  UPDATE_COMPLETE - AWS::Lambda::Function - MainLambdaFunction
  CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1676033719487
  CREATE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1676033719487
  CREATE_COMPLETE - AWS::ApiGateway::Deployment - ApiGatewayDeployment1676033719487
  UPDATE_COMPLETE_CLEANUP_IN_PROGRESS - AWS::CloudFormation::Stack - main-app-staging
  DELETE_IN_PROGRESS - AWS::ApiGateway::Deployment - ApiGatewayDeployment1675984563931
  DELETE_COMPLETE - AWS::ApiGateway::Deployment - ApiGatewayDeployment1675984563931
  UPDATE_COMPLETE - AWS::CloudFormation::Stack - main-app-staging
× Stack main-app-staging failed to deploy (59s)
Environment: linux, node 14.21.2, framework 3.27.0, 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: Failed to find CloudFormation resources for 'api-staging-main./****.com':
Failed to find a stack main-app-dev
    at ServerlessCustomDomain.<anonymous> (/builds/****/main/app/node_modules/serverless-domain-manager/dist/src/index.js:413:23)
    at Generator.throw (<anonymous>)
    at rejected (/builds//****/main/app/node_modules/serverless-domain-manager/dist/src/index.js:6:65)
    at processTicksAndRejections (internal/process/task_queues.js:95:5)
Cleaning up project directory and file based variables

FYI my CICD if useful:

serverless:
  stage: deploy
  image: nikolaik/python-nodejs:python3.9-nodejs14
  resource_group: $CI_COMMIT_REF_NAME
  environment:
    name: $CI_COMMIT_REF_NAME
    url: $PUBLIC_BASE_URL
  before_script:
    - npm install -g --unsafe-perm=true --allow-root serverless
    - npm install serverless-domain-manager --save-dev
    - npm install --save-dev serverless-apigw-binary
    - npm install serverless-s3-deploy
    - apt update
    - apt install gettext -y
    - serverless deploy --stage $CI_COMMIT_REF_NAME --verbose

  only:
    - production
    - staging

Do you know what could be wrong ?

thanks

Hi @yeyeric

As I see you are using plugin version 6.2.3
Could you please use the latest one and let us know?

is there any dependency which could explain that ? From my CICD I would expect the latest version to be installed, wouldn't it ?

I think it's another plugin
I can see:

npm install serverless-domain-manager
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN saveError ENOENT: no such file or directory, open '/builds/***/main/app/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/builds/***/main/app/package.json'
npm WARN app No description
npm WARN app No repository field.
npm WARN app No README data
npm WARN app No license field.
+ serverless-domain-manager@6.3.3
added 32 packages from 70 contributors and audited 32 packages in 5.978s
12 packages are looking for funding
  run `npm fund` for details
found 0 vulnerabilities

Reverting to 6.3.2 is OK, 6.3.3 fails so definitely related to 6.3.3

Sample of my serverless.yml also, I think it may be related to the fact I'm using a custom stage parameter ?

service: main-app

plugins:
  - serverless-domain-manager
  - serverless-apigw-binary
  - serverless-s3-deploy


  customDomain:
    domainName: ${env:CI_ENVIRONMENT_URL}
    certificateName: '*.****.com'
    endpointType: 'regional'

It might be
Will you be able to check it?

how ?

Just try to remove the custom stage from the customDomain config

well there is no use of the stage in it as you can see in the yml extract.

but I think the stage which is somehow looked for by the package match the "yml" stage which defaults to dev if not in. If I force stage in my yml to staging, then deployment is successful (with 6.3.3), just tested, so this is related to the wrong stage being picked

Mine is passed at runtime by the cicd and in my case it's staging / production, I'll try to check if I can set it at run time in the yml but for all those using opt:stage I think there will be a problem

Thank you for the hint!

I will need some time to debug it

@yeyeric could you please try v6.3.4?

i've updated my yml to use self.provider instead, I guess others will revert if still a problem
thanks for the quick fix !