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

Getting invalid count value errors intermittently during deployment #8667

Closed
asnaseer-resilient opened this issue Jun 20, 2020 · 2 comments · Fixed by #8675
Closed

Getting invalid count value errors intermittently during deployment #8667

asnaseer-resilient opened this issue Jun 20, 2020 · 2 comments · Fixed by #8675
Assignees
Labels
bug This issue is a bug.

Comments

@asnaseer-resilient
Copy link

I intermittently see errors reported below this during my stack deployments.
The error I have shown is an example from trying to deploy a lambda function but I also see this during deployments of RDS and AppSync. This never occurred on the previous version of the CDK that I was running (v1.39.0)

Reproduction Steps

I use CircleCI to deploy my stacks. A typical deployment command looks like this:

cdk deploy dbSchemaMigrator --app .build/stacks/cfd-api-stacks.js -o .build/cdk.out/dbSchemaMigrator --no-staging --exclusively --require-approval never

Not sure if this is relevant as I never saw this error in the older release of the CDK.

When my CircleCI build fails with the above error, I can see that the actual AWS stack has been created successfully so I suspect there is an error in the stack progress monitoring code in the latest release. Re-running my CircleCI job always succeeds.

Error Log

dbSchemaMigrator (cfd-api-dbSchemaMigrator-uat): deploying...
[0%] start: Publishing a747fb3608b7a2e29cc9cd7a740f4df1d5081a0cea693982c96991f1a3ed5e25:current
[100%] success: Published a747fb3608b7a2e29cc9cd7a740f4df1d5081a0cea693982c96991f1a3ed5e25:current
cfd-api-dbSchemaMigrator-uat: creating CloudFormation changeset...
 ❌  dbSchemaMigrator (cfd-api-dbSchemaMigrator-uat) failed: RangeError: Invalid count value
    at String.repeat (<anonymous>)
    at CurrentActivityPrinter.progressBar (/home/circleci/project/node_modules/aws-cdk/lib/api/util/cloudformation/stack-activity-monitor.ts:558:24)
    at CurrentActivityPrinter.print (/home/circleci/project/node_modules/aws-cdk/lib/api/util/cloudformation/stack-activity-monitor.ts:494:23)
    at StackActivityMonitor.flushEvents (/home/circleci/project/node_modules/aws-cdk/lib/api/util/cloudformation/stack-activity-monitor.ts:151:18)
    at StackActivityMonitor.stop (/home/circleci/project/node_modules/aws-cdk/lib/api/util/cloudformation/stack-activity-monitor.ts:106:12)
    at processTicksAndRejections (internal/process/task_queues.js:94:5)
    at Object.deployStack (/home/circleci/project/node_modules/aws-cdk/lib/api/deploy-stack.ts:271:7)
    at CdkToolkit.deploy (/home/circleci/project/node_modules/aws-cdk/lib/cdk-toolkit.ts:181:24)
    at main (/home/circleci/project/node_modules/aws-cdk/bin/cdk.ts:252:16)
    at initCommandLine (/home/circleci/project/node_modules/aws-cdk/bin/cdk.ts:184:9)
Invalid count value

Environment

  • CLI Version : v1.46.0
  • Node.js Version: circleci/node:12.14.1
  • OS : CircleCI node_executor
  • Language (Version): Typescript 3.9.5

Other

I also see this error intermittently when trying to run the deploy script on my local machine (Mac OS Catalina 10.15.5) with Node 12.4.0.

This is 🐛 Bug Report

@asnaseer-resilient asnaseer-resilient added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Jun 20, 2020
@NetaNir
Copy link
Contributor

NetaNir commented Jun 21, 2020

You are correct, the errors is thrown from the progress bar visualization code (that was added in version 1.46.0), as you said this does not effect the actual deployment as CloudFormation deployments are asynchronies.

We are on it, sorry for that!


@rix0rrr the error is probably due to calling String.repeat with a negative value here:

 const filler = '·'.repeat(width - 2 - Math.floor(chars) - (partialChar ? 1 : 0));

I tried some combinations but couldn't find an immediate suspect.

@NetaNir NetaNir removed the needs-triage This issue or PR still needs to be triaged. label Jun 21, 2020
@asnaseer-resilient
Copy link
Author

What about changing that line to:

const filler = '·'.repeat(Math.max(0, width - 2 - Math.floor(chars) - (partialChar ? 1 : 0)));

rix0rrr added a commit that referenced this issue Jun 22, 2020
Fix a monitor crash that happens when a narrow terminal width is
reported, leading the calculation for progress bar filler to go negative.

Fixes #8667.
@mergify mergify bot closed this as completed in #8675 Jun 22, 2020
mergify bot pushed a commit that referenced this issue Jun 22, 2020
Fix a monitor crash that happens when a narrow terminal width is
reported, leading the calculation for progress bar filler to go negative.

Fixes #8667.


----

*By submitting this pull request, I confirm that my contribution is made under the terms of the Apache-2.0 license*
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants