AWS CodeCatalyst Java Serverless REST Microservice Blueprint Workflow Definition Issue

0

TL;DR

Change this:

Actions:
  ...
  BackendCDKDeploy:
    Identifier: aws/cdk-deploy@v1
    Compute:
      Type: Lambda

To this:

Actions:
  ...
  BackendCDKDeploy:
    Identifier: aws/cdk-deploy@v1
    Compute:
      Type: EC2

If you're working with a Java project that requires bundling with docker


Over the past couple of days I've been diagnosing an issue with a project I started using AWS CodeCatalyst. During the initial setup, the workflow failed at the BackendCDKDeploy workflow step:

Failed BackendCDKDeploy Step Picture

In almost every instance of debugging, I received the following error message on the CDK deploy step:

Running command AWS_REGION=us-west-2 cdk diff MyAppStack-u8c2o --fail --context stack_name=MyAppStack-u8c2o

2023-06-25T17:30:28.3659591Z [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.0.0:java (default-cli) on project java: An exception occured while executing the Java class. Failed to bundle asset MyAppStack-u8c2o/getTodos/Code/Stage, bundle output is located at /tmp/codecatalyst/output/src112/src/git-codecommit.us-west-2.amazonaws.com/v1/repos/source-repository-{big hash}/cdk.out/asset.{big hash}-error: Error: spawnSync docker EACCES

After working through a number of different possible solutions, modifying the cdk.json and stack definitions, I traced the issue to a configuration error in the workflow.


spawnSync docker EACCES would typically lend itself to an file executable permissions error based on this reference. Though, exhaustively searching the lambda compute instance for a docker executable to update permissions for the run-as user was turning up nothing. Reading through the codecatalyst docs to figure out why this was - The CodeCatalyst default Lambda compute does not come with a docker executable


The EC2 image does come with a docker executable, upon changing the workflow configuration compute for CDKDeploy from Lambda to EC2, the CDKDeploy step started working.

Anthony
asked 10 months ago266 views
1 Answer
1

Hi Anthony,

Thank you for flagging this out. We are looking into making the Java Serverless REST Microservice BlueprintBlueprint work for Java. I will inform you as soon as we have implemented a fix.

AWS
EXPERT
answered 10 months ago

You are not logged in. Log in to post an answer.

A good answer clearly answers the question and provides constructive feedback and encourages professional growth in the question asker.

Guidelines for Answering Questions