Help debugging Java Lambda Layer

Trying to use a Java lambda layer in community edition and my code dies with a java.lang.NoClassDefFoundError as if the layer isn’t actually being added to the classpath, though “awslocal lambda get-function” shows the layer there. Seems the container doesn’t stick around after the failure. Any tips on how to debug this?

Localstack version 2.02

localstack_main | 2023-05-04T15:20:42.238 WARN — [er:$LATEST_0] l.u.c.container_client : Overwriting Docker container privileged flag None with new value False

localstack_main | 2023-05-04T15:20:47.064 INFO — [ asgi_gw_12] localstack.request.http : POST /_localstack_lambda/ef1bebf598900a45412a85136b0346ae/status/ef1bebf598900a45412a85136b0346ae/ready => 202
localstack_main | 2023-05-04T15:20:47.141 WARN — [ asgi_gw_3] l.s.a.i.executor_endpoint : Execution environment startup failed: {“errorMessage”:“Error loading class com.britive.scs.CleanupTaskDispatcher: com/amazonaws/client/builder/AwsClientBuilder”,“errorType”:“java.lang.NoClassDefFoundError”,“stackTrace”:[“java.lang.NoClassDefFoundError: com/amazonaws/client/builder/AwsClientBuilder\n\tat java.lang.Class.forName0(Native Method)\n\tat java.lang.Class.forName(\nCaused by: java.lang.ClassNotFoundException: com.amazonaws.client.builder.AwsClientBuilder\n\tat\n\tat java.lang.ClassLoader.loadClass(\n\tat java.lang.ClassLoader.loadClass(\n\t… 2 more\n”]}
localstack_main | 2023-05-04T15:20:47.141 ERROR — [ asgi_gw_3] : exception during call chain: Runtime Handler can only error while starting
localstack_main | 2023-05-04T15:20:47.142 INFO — [ asgi_gw_3] localstack.request.http : POST /_localstack_lambda/ef1bebf598900a45412a85136b0346ae/status/ef1bebf598900a45412a85136b0346ae/error => 500
localstack_main | 2023-05-04T15:20:47.160 INFO — [ asgi_gw_9] localstack.request.http : POST /_localstack_lambda/ef1bebf598900a45412a85136b0346ae/invocations/183c2d95-45d7-41cc-95db-6a1beba49cf4/logs => 202
localstack_main | 2023-05-04T15:20:47.163 INFO — [ asgi_gw_6] localstack.request.http : POST /_localstack_lambda/ef1bebf598900a45412a85136b0346ae/invocations/183c2d95-45d7-41cc-95db-6a1beba49cf4/error => 202
localstack_main | 2023-05-04T15:20:47.164 INFO — [ asgi_gw_13] : AWS lambda.Invoke => 200

Just verified the same zip files (lambda function & layer) work in AWS.

Hi @mpsharp,
You will need to have LocalStack Pro license to use Lambda Layers locally.

Lambda layers lets you include additional code and dependencies in your Lambda functions. With LocalStack Pro/Team, you can deploy Lambda Layers locally to streamline your development and testing process.