

Amazon CodeCatalyst is no longer open to new customers. Existing customers can continue to use the service as normal. For more information, see [How to migrate from CodeCatalyst](migration.md).

# Troubleshooting projects and blueprints
<a name="projects-troubleshooting"></a>

This section can help you troubleshoot some common issues you might encounter while working with projects and blueprints in Amazon CodeCatalyst.

# Java API with AWS Fargate blueprint missing dependencies for apache-maven-3.8.6
<a name="projects-troubleshooting-error-maven"></a>

**Issue:** For a project created from the Java API with AWS Fargate blueprint, the workflow fails with an error for missing `apache-maven-3.8.6` dependencies. The workflow fails with output similar to the following example:

```
Step 8/25 : RUN wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz -P /tmp
---> Running in 1851ce6f4d1b
[91m--2023-03-10 01:24:55--  https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz
[0m[91mResolving dlcdn.apache.org (dlcdn.apache.org)... 
[0m[91m151.101.2.132, 2a04:4e42::644
Connecting to dlcdn.apache.org (dlcdn.apache.org)|151.101.2.132|:443... 
[0m[91mconnected.
[0m[91mHTTP request sent, awaiting response... [0m[91m404 Not Found
2023-03-10 01:24:55 ERROR 404: Not Found.
[0mThe command '/bin/sh -c wget https://dlcdn.apache.org/maven/maven-3/3.8.6/binaries/apache-maven-3.8.6-bin.tar.gz -P /tmp' returned a non-zero code: 8
[Container] 2023/03/10 01:24:55 Command failed with exit status 8
```

**Solution:** Update the blueprint Dockerfile using the following steps.

1. In the search bar, enter `apache-maven-3.8.6` to locate the dockerfile inside the project created with the Java API with AWS Fargate blueprint.

1.  Update the Dockerfile (`/static-assets/app/Dockerfile`) to use `maven:3.9.0-amazoncorretto-11` as a base image and remove the dependency on the `apache-maven-3.8.6` package. 

1. (Recommended) We also recommend updating the Maven heap size to 6 GB.

Below is an example Dockerfile.

```
FROM maven:3.9.0-amazoncorretto-11 AS builder

COPY ./pom.xml ./pom.xml
COPY src ./src/

ENV MAVEN_OPTS='-Xmx6g'

RUN mvn -Dmaven.test.skip=true clean package

FROM amazoncorretto:11-alpine

COPY —from=builder target/CustomerService-0.0.1.jar CustomerService-0.0.1.jar
EXPOSE 80
CMD ["java","-jar","-Dspring.profiles.active=prod","/CustomerService-0.0.1.jar", "—server.port=80"]
```

# Modern three-tier web application blueprint workflow **OnPullRequest** fails with permissions error for Amazon CodeGuru
<a name="projects-troubleshooting-onpullrequest"></a>

**Issue:** When I try to run a workflow for my project, the workflow fails to run with the following message: 

```
Failed at codeguru_codereview: The action failed during runtime. View the action's logs for more details.
```

``

**Solution:** One possible cause of this action failure might be due to missing permissions in the IAM role policy, where your version of the service role used by CodeCatalyst in the connected AWS account is missing required permissions for the **codeguru\$1codereview** action to run successfully. To fix this problem, either the service role must be updated with the required permissions, or you must change the service role used for the workflow to one that has the required permissions for Amazon CodeGuru and Amazon CodeGuru Reviewer. Using the following steps, find your role and update the role policy permissions in order to allow the workflow to run successfully.

**Note**  
These steps apply for the following workflows in CodeCatalyst:  
The **OnPullRequest** workflow provided for projects created with the Modern three-tier web application blueprint in CodeCatalyst.
Workflows added to projects in CodeCatalyst with actions that access Amazon CodeGuru or Amazon CodeGuru Reviewer.

Each project contains workflows with actions that use a role and environment provided by the AWS account connected to your project in CodeCatalyst. The workflow with the actions and their designated policy is stored in your source repository in the directory /.codecatalyst/workflows. Modifying the workflow YAML is not required unless you are adding a new role ID to the existing workflow. For information about YAML template elements and formatting, see [Workflow YAML definition](workflow-reference.md).

These are the high-level steps to follow to edit your role policy and verify the workflow YAML.

**To reference your role name in the workflow YAML and update the policy**

1. Open the CodeCatalyst console at [https://codecatalyst.aws/](https://codecatalyst.aws/).

1. Navigate to your CodeCatalyst space. Navigate to your project.

1. Choose **CI/CD**, and then choose **Workflows**. 

1. Choose the workflow titled **OnPullRequest**. Choose the **Definition** tab.

1. In the workflow YAML, in the `Role:` field under the **codeguru\$1codereview** action, make a note of the role name. This is the role with the policy that you will modify in IAM. The following example shows the role name.  
![\[View the IAM role name in the workflow YAML\]](http://docs.aws.amazon.com/codecatalyst/latest/userguide/images/projects/ts-workflow-role.png)

1. Do one of the following:
   + (Recommended) Update the service role connected to your project with the required permissions for Amazon CodeGuru and Amazon CodeGuru Reviewer. The role will have a name `CodeCatalystWorkflowDevelopmentRole-spaceName` with a unique identifier appended. For more information about the role and role policy, see [Understanding the **CodeCatalystWorkflowDevelopmentRole-*spaceName*** service role](ipa-iam-roles.md#ipa-iam-roles-service-role). Proceed to the next steps to update the policy in IAM.
**Note**  
You must have AWS administrator access to the AWS account with the role and policy. 
   + Change the service role used for the workflow to one that has the required permissions for Amazon CodeGuru and Amazon CodeGuru Reviewer or create a new role with the required permissions.

1. Sign in to the AWS Management Console and open the IAM console at [https://console.aws.amazon.com/iam/](https://console.aws.amazon.com/iam/).

   In the IAM console, find the role from step 5, such as `CodeCatalystPreviewDevelopmentRole`.

1. In the role from step 5, change the permission policy to include the `codeguru-reviewer:*` and `codeguru:*` permissions. After adding these permissions, the permission policy should look similar to the following:

1. After you make the policy corrections, return to CodeCatalyst and start the workflow run again.

## Still looking to solve your problem?
<a name="projects-last-help"></a>

You can go to [Amazon CodeCatalyst](https://codecatalyst.aws/) or fill out a [Support Feedback form](https://support.aws.amazon.com/#/contacts/aws-account-support/). In the **Request information** section, under ** How can we help you**, include that you are an Amazon CodeCatalyst customer. Provide as much detail as possible so that we can most efficiently address your issue.