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

cdklocal bootstrap command fails #91

Closed
nicolasduminil opened this issue Jun 3, 2024 · 8 comments
Closed

cdklocal bootstrap command fails #91

nicolasduminil opened this issue Jun 3, 2024 · 8 comments
Labels

Comments

@nicolasduminil
Copy link

Hello,

I'm trying to test locally some Java CDK code which works as expected in the cloud, when deployed with cdk but fails with cdklocal. Trying to run cdklocal deploy raises the following exception:

$ cdklocal bootstrap
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:java (default-cli) on project quarkus-s3: An  exception occurred while executing the Java class. path is required -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:java (default-cli) on project quarkus-s3: An exception occurred while executing the Java class. path is required
 at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:333)
 at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
 at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
 at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
 at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
 at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
 at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
 at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
 at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
 at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
 at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
 at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
 at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
 at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
 at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
 at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
 at java.lang.reflect.Method.invoke (Method.java:580)
 at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
 at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
 at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
 at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
Caused by: org.apache.maven.plugin.MojoExecutionException: An exception occurred while executing the Java class. path is required
    at org.codehaus.mojo.exec.ExecJavaMojo.execute (ExecJavaMojo.java:349)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:126)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 (MojoExecutor.java:328)
    at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute (MojoExecutor.java:316)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:212)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:174)
    at org.apache.maven.lifecycle.internal.MojoExecutor.access$000 (MojoExecutor.java:75)
    at org.apache.maven.lifecycle.internal.MojoExecutor$1.run (MojoExecutor.java:162)
    at org.apache.maven.plugin.DefaultMojosExecutionStrategy.execute (DefaultMojosExecutionStrategy.java:39)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:159)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:105)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:73)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:53)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:118)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:261)
   at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:173)
   at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:101)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:906)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:283)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:206)
    at jdk.internal.reflect.DirectMethodHandleAccessor.invoke (DirectMethodHandleAccessor.java:103)
    at java.lang.reflect.Method.invoke (Method.java:580)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:283)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:226)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:407)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:348)
Caused by: java.lang.NullPointerException: path is required
    at java.util.Objects.requireNonNull (Objects.java:259)
    at software.amazon.awscdk.services.lambda.Code.fromAsset (Code.java:63)
    at fr.simplex_software.aws.iac.cdk.CdkApiGatewayStack.<init> (CdkApiGatewayStack.java:27)
    at fr.simplex_software.aws.iac.cdk.CdkApiGatewayApp.main (CdkApiGatewayApp.java:13)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:279)
    at java.lang.Thread.run (Thread.java:1583)

localstack is running, of course, as shown below:

$ curl http://localhost:4566/_localstack/health | jq
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100   870  100   870    0     0   266k      0 --:--:-- --:--:-- --:--:--  283k
{
  "services": {
    "acm": "available",
    "apigateway": "available",
    "cloudformation": "available",
    "cloudwatch": "available",
    "config": "available",
    "dynamodb": "available",
    "dynamodbstreams": "available",
    "ec2": "available",
    "es": "available",
    "events": "available",
    "firehose": "available",
    "iam": "available",
    "kinesis": "available",
    "kms": "available",
    "lambda": "available",
    "logs": "available",
    "opensearch": "available",
    "redshift": "available",
    "resource-groups": "available",
    "resourcegroupstaggingapi": "available",
    "route53": "available",
    "route53resolver": "available",
    "s3": "running",
    "s3control": "available",
    "secretsmanager": "available",
    "ses": "available",
    "sns": "available",
    "sqs": "available",
    "ssm": "running",
    "stepfunctions": "available",
    "sts": "running",
    "support": "available",
    "swf": "available",
    "transcribe": "available"
  },
  "version": "2.1.1.dev"
}

What might the problem be here ?

Many thanks in advance for your help.

Nicolas

@nicolasduminil
Copy link
Author

My bad, I forgot to mention the function.zip location. The correct command is:

cdklocal bootstrap --context zip=target/function.zip

Closing the issue.

@nicolasduminil
Copy link
Author

However, trying to deploy the stack fails, as shown below:

 ⏳  Bootstrapping environment aws://000000000000/eu-west-3...
Trusted accounts for deployment: (none)
Trusted accounts for lookup: (none)
Using default execution policy of 'arn:aws:iam::aws:policy/AdministratorAccess'. Pass '--cloudformation-execution-policies' to customize.
CDKToolkit: creating CloudFormation changeset...
 ✅  Environment aws://000000000000/eu-west-3 bootstrapped.


✨  Synthesis time: 5.84s

QuarkusApiGatewayStack:  start: Building   21f84d584c17f8a8cdea5c8e085db669896706d3c0029cfe269b28b6d6210e94:current_account-current_region
QuarkusApiGatewayStack:  success: Built 21f84d584c17f8a8cdea5c8e085db669896706d3c0029cfe269b28b6d6210e94:current_account-current_region
QuarkusApiGatewayStack:  start: Building 9746efb52d33333304faf5095f89c6bd4c1f7c20544dac121ec2a134e28c01f2:current_account-current_region
QuarkusApiGatewayStack:  success: Built 9746efb52d33333304faf5095f89c6bd4c1f7c20544dac121ec2a134e28c01f2:current_account-current_region
QuarkusApiGatewayStack:  start: Publishing 21f84d584c17f8a8cdea5c8e085db669896706d3c0029cfe269b28b6d6210e94:current_account-current_region
QuarkusApiGatewayStack:  start: Publishing 9746efb52d33333304faf5095f89c6bd4c1f7c20544dac121ec2a134e28c01f2:current_account-current_region
QuarkusApiGatewayStack:  success: Published 9746efb52d33333304faf5095f89c6bd4c1f7c20544dac121ec2a134e28c01f2:current_account-current_region
QuarkusApiGatewayStack:  success: Published 21f84d584c17f8a8cdea5c8e085db669896706d3c0029cfe269b28b6d6210e94:current_account-current_region
QuarkusApiGatewayStack: deploying... [1/1]
QuarkusApiGatewayStack: creating CloudFormation changeset...

 ❌  QuarkusApiGatewayStack failed: Error: The stack named QuarkusApiGatewayStack failed to deploy: CREATE_FAILED (Deployment failed)
    at FullCloudFormationDeployment.monitorDeployment (/usr/local/lib/node_modules/aws-cdk/lib/index.js:433:10615)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.deployStack2 [as deployStack] (/usr/local/lib/node_modules/aws-cdk/lib/index.js:436:199343)
    at async /usr/local/lib/node_modules/aws-cdk/lib/index.js:436:180749

 ❌ Deployment failed: Error: The stack named QuarkusApiGatewayStack failed to deploy: CREATE_FAILED (Deployment failed)
    at FullCloudFormationDeployment.monitorDeployment (/usr/local/lib/node_modules/aws-cdk/lib/index.js:433:10615)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Object.deployStack2 [as deployStack] (/usr/local/lib/node_modules/aws-cdk/lib/index.js:436:199343)
    at async /usr/local/lib/node_modules/aws-cdk/lib/index.js:436:180749

The stack named QuarkusApiGatewayStack failed to deploy: CREATE_FAILED (Deployment failed)

I might have closed to early the issue, sorry :-).

@Anze1508 Anze1508 added the bug Something isn't working label Jun 4, 2024
@nicolasduminil
Copy link
Author

Could anyone help please ?

@MarcelStranak
Copy link

Hi @nicolasduminil, can you please test if you are still getting the same issue with the latest version of LocalStack?
You can get the latest version by pulling the image docker pull localstack/localstack:latest

@nicolasduminil
Copy link
Author

@MarcelStranak : yes, I confirm that using localstack/localstack:latest I'm getting exactly the same exception.

@MarcelStranak
Copy link

Hi @nicolasduminil,

Please provide the full sample so we can replicate the error Caused by: java.lang.NullPointerException: path is required
I would also like to share list of resources that are supported in the community version: https://docs.localstack.cloud/user-guide/aws/cloudformation/#resources

@lakkeger
Copy link
Contributor

Hi @nicolasduminil,
Just checking in to verify if this issue had been resolved or not?

@lakkeger
Copy link
Contributor

Due to inactivity I'm closing this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants