aws-cdk-examples icon indicating copy to clipboard operation
aws-cdk-examples copied to clipboard

https://github.com/aws-samples/aws-cdk-examples/tree/master/java/static-site is not working

Open nagkumar opened this issue 3 years ago • 1 comments
trafficstars

Describe the bug

env variables are correct, but still gives error

Expected Behavior

this example should work locally

Current Behavior

[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:java (default-cli) on project static-site: An exception occurred while executing the Java class. Error: Cannot retrieve value from context provider hosted-zone since account/region are not specified at the stack level. Configure "env" with an account and region when you define your stack.See https://docs.aws.amazon.com/cdk/latest/guide/environments.html for more details. [ERROR] @jsii/kernel.RuntimeError: Error: Cannot retrieve value from context provider hosted-zone since account/region are not specified at the stack level. Configure "env" with an account and region when you define your stack.See https://docs.aws.amazon.com/cdk/latest/guide/environments.html for more details. [ERROR] at Kernel._ensureSync (C:\Users\RAJANA~1\AppData\Local\Temp\jsii-java-runtime14064205540975823778\lib\program.js:7889:27) [ERROR] at Kernel.sinvoke (C:\Users\RAJANA~1\AppData\Local\Temp\jsii-java-runtime14064205540975823778\lib\program.js:7325:34) [ERROR] at KernelHost.processRequest (C:\Users\RAJANA~1\AppData\Local\Temp\jsii-java-runtime14064205540975823778\lib\program.js:10466:36) [ERROR] at KernelHost.run (C:\Users\RAJANA~1\AppData\Local\Temp\jsii-java-runtime14064205540975823778\lib\program.js:10429:22) [ERROR] at Immediate._onImmediate (C:\Users\RAJANA~1\AppData\Local\Temp\jsii-java-runtime14064205540975823778\lib\program.js:10430:46) [ERROR] at process.processImmediate (node:internal/timers:471:21)

Reproduction Steps

cdk ls

Possible Solution

No response

Additional Information/Context

No response

CDK CLI Version

2.43.1 (build c1ebb85)

Framework Version

No response

Node.js Version

nod 18

OS

win 10

Language

Java

Language Version

18

nagkumar avatar Sep 27 '22 04:09 nagkumar

Able to reproduce the issue by running below commands mvn compile cdk ls cdk bootstrap cdk deploy -c domain=mystaticsite.com -c subdomain=www --all

Actually, this is considered an warning which only occurs when running cdk synth/deploy/destroy. It DOES NOT block the cdk process as there are default region/account values set in example code or local aws configure.

As suggested in the warning log itself as well as in another issue (https://github.com/aws-samples/aws-cdk-examples/issues/238), follow this guide (https://docs.aws.amazon.com/cdk/v2/guide/environments.html) to set the account and region env in your code.

liyanone avatar Mar 16 '23 06:03 liyanone

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see. If you need more assistance, please either tag a team member or open a new issue that references this one. If you wish to keep having a conversation with other community members under this issue feel free to do so.

github-actions[bot] avatar Dec 27 '24 21:12 github-actions[bot]