Skip to content

❗ NOTICE : aws-cdk-lib : validation errors detected: Value '' at 'stackName' failedΒ #31654

@dpilch

Description

@dpilch

Please add your +1 πŸ‘ to let us know you have encountered this


Status: RESOLVED

Overview:

The latest CDK release (https://github.com/aws/aws-cdk/releases/tag/v2.161.0) appears to have reintroduced #27526.

Intermittently when deploying the following error is printed.

Complete Error Message:

Error occurred while monitoring stack: Error [ValidationError]: 2 validation errors detected: Value '' at 'stackName' failed to satisfy constraint: Member must have length greater than or equal to 1; Value '' at 'stackName' failed to satisfy constraint: Member must satisfy regular expression pattern: [a-zA-Z][-a-zA-Z0-9]*|arn:[-a-zA-Z0-9:/._+]*
    at Request.extractError (/Users/dppilche/amplify/apps/canaryfailures/node_modules/aws-cdk/lib/index.js:439:46717)
    at Request.callListeners (/Users/dppilche/amplify/apps/canaryfailures/node_modules/aws-cdk/lib/index.js:439:91820)
    at Request.emit (/Users/dppilche/amplify/apps/canaryfailures/node_modules/aws-cdk/lib/index.js:439:91268)
    at Request.emit (/Users/dppilche/amplify/apps/canaryfailures/node_modules/aws-cdk/lib/index.js:439:200231)
    at Request.transition (/Users/dppilche/amplify/apps/canaryfailures/node_modules/aws-cdk/lib/index.js:439:193784)
    at AcceptorStateMachine.runTo (/Users/dppilche/amplify/apps/canaryfailures/node_modules/aws-cdk/lib/index.js:439:158656)
    at /Users/dppilche/amplify/apps/canaryfailures/node_modules/aws-cdk/lib/index.js:439:158986
    at Request.<anonymous> (/Users/dppilche/amplify/apps/canaryfailures/node_modules/aws-cdk/lib/index.js:439:194076)
    at Request.<anonymous> (/Users/dppilche/amplify/apps/canaryfailures/node_modules/aws-cdk/lib/index.js:439:200306)
    at Request.callListeners (/Users/dppilche/amplify/apps/canaryfailures/node_modules/aws-cdk/lib/index.js:439:91988) {
  code: 'ValidationError',
  time: 2024-10-04T17:03:05.124Z,
  requestId: '8690e75f-bc8f-4d58-a6cf-6b86c941a799',
  statusCode: 400,
  retryable: false,
  retryDelay: 292.29573100392116
}

The last time this issue was present was because the describeStackEvents was called with { stackName: '' }. #27526 (comment). This recent PR #31407 touched the area of code that caused the previous issue.

Workaround:

Pin CDK version to 2.160.0

Solution:

Related Issues:

Regression Issue

  • Select this option if this issue appears to be a regression.

Last Known Working CDK Version

v2.160.0

Expected Behavior

The monitoring behavior should not attempt to describe a stack without providing the stack name.

Current Behavior

See error message above. The issue is intermittent.

Reproduction Steps

I am reliable reproducing the error when using Amplify Gen 2 (which under the hood uses the Amplify GraphQL API construct).

mkdir cdkmonitoringbug
cd cdkmonitoringbug
npm create amplify@latest
npx ampx sandbox 

The error message should show after this. If does not, try npx ampx sandbox delete and then npx ampx sandbox.

I haven't tested this yet, but the following guide would probably lead to the error as well. https://aws.amazon.com/blogs/mobile/announcing-aws-amplifys-graphql-api-cdk-construct-deploy-real-time-graphql-api-and-data-stack-on-aws/

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.161.0 (build be5ad8b)

Framework Version

No response

Node.js Version

v18.20.4

OS

mac os 14.7

Language

TypeScript

Language Version

typescript@5.6.2

Other information

No response

Metadata

Metadata

Assignees

Labels

@aws-cdk/aws-amplifyRelated to AWS AmplifybugThis issue is a bug.p0package/toolsRelated to AWS CDK Tools or CLIpotential-regressionMarking this issue as a potential regression to be checked by team memberresponse-requestedWaiting on additional info and feedback. Will move to "closing-soon" in 7 days.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions