question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[ssm] BucketName: "dummy-value-for-" results in unpredictable behavior

See original GitHub issue

SystemsManager parameter lookup returns “dummy-value-for-XXXX” at first run. But if used as a part of BucketName, this throws an exception on invalid bucket name

This results in unpredictable behavior

  • synth/deploy may work for several code changes in a row,
  • and fail miserably after cdk context --clear

Reproduction Steps

var bucketName = StringParameter.ValueFromLookup(stack, "/ssm/param/bucketName");
var bucketProps = new BucketProps { BucketName = bucketName, }

Error Log

Unhandled exception. Amazon.JSII.Runtime.JsiiException: Invalid S3 bucket name (value: logs.dummy-value-for-/ssm/param/bucketName)
Bucket name must be at least 3 and no more than 63 characters
Bucket name must only contain lowercase characters and the symbols, period (.) and dash (-) (offset: 21)

Environment

  • cdk --version 1.51.0 (build 8c2d53c)

  • Node.js Version: v12.7.0
  • OS: Windows
  • Language (Version): C#

Other

Can you please check for dummy and not throw from resource constructors? You do check for tokens already, don’t you?


This is 🐛 Bug Report

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:9
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
jsamarziyacommented, Jun 9, 2022

A potential workaround might be to use StringParameter.valueForStringParameter() instead of StringParameter.valueFromLookup(). That method returns a token instead of a string, and I found that it worked for me in the case of

s3.Bucket.fromBucketName(stack, "MyBucket", ssm.StringParameter.valueForStringParameter(stack, "myBucketParamName"))
1reaction
gel1123commented, Nov 30, 2021

Almost the same problem occurs when specifying a custom domain in API Gateway.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ARM assemble Program Error- "This Register Combination ...
A1477E This register combination results in UNPREDICTABLE behavior This error is generated when you are assembling an instruction that has ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found