CMSgov/dpc-app

View on GitHub
Troubleshooting.md

Summary

Maintainability
Test Coverage
# Troubleshooting

Below are some issues and solutions that may arise while setting up your local environment.

|                        | Action                                   | Error                                                                                                                                                                                                                                                                                                                                     | Comment                                                                                                                                                                         | Snippet                                           |
|------------------------|------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------|
| **Build Issues**       |                                          |                                                                                                                                                                                                                                                                                                                                           |                                                                                                                                                                                 |                                                   |
|                        | Running the ```make ci-app``` command    | Produces:  <br/><pre>[ERROR] Failed to execute goal  <br/>org.apache.maven.plugins:maven-javadoc-plugin:3.2.0:jar (attach-javadocs)  <br/>on project dpc-testing:    <br/>MavenReportException: <br/>Error while generating Javadoc: <br/>Unable to find javadoc command: The environment variable JAVA_HOME is not correctly set. </pre> | Add the following to the project's `pom.xml`  file.                                                                                                                             | [pom profile snippet](#pom-xml-profile-node)      |
|                        | Running the ```make ci-app``` command    | You see a test failure for the DPC Public API Service <br/>DPC referencing the Surefire plugin and a terminated VM.                                                                                                                                                                                                                       | This is a known issue and the test error **WILL NOT** stop you from being able to run the DPC application locally.                                                              |                                                   |
|                        | Running the ```make ci-app``` command    | Produces:  <br/><pre>[ERROR] BFD_HASH_PEPPER value cannot be found </pre> *NOTE*: This is hard to reproduce, so the wording may be different.                                                                                                                                                                                             | Check the `BFD_HASH_PEPPER` values from the decrypted files are present. Restart the build process. One dev had succes restarting the IDE before restaring the build process.   |                                                   |
|                        | Running the ```make start-dpc``` command | Produces:  <br/><pre>Starting dpc-app_aggregation_1 ... error  <br/>ERROR: for dpc-app_aggregation_1  <br/>Cannot start service aggregation: <br/>error while mounting volume '/var/lib/docker/volumes/dpc-app_export-volume/_data':</pre>                                                                                                | This occurred after restarting the local system. Resolved by removing the dpc-aggregation image from Docker                                                                     |                                                   |
|                        | Running the ```make start-app``` command | Fails with an authentication-type error                                                                                                                                                                                                                                                                                                   | Re-run the `make start-app` command                                                                                                                                             |                                                   |
|                        | Logging in to DPC Portal                 | Fails with newly created credentials                                                                                                                                                                                                                                                                                                      | Needed to refresh the cache by running ``` docker exec -it {id} rails dev:cache``` , where ```{id}``` is the Docker Container ID of the **dpc-web:latest** container            |                                                   |
|                        | Logging in successfully                  | Fails to show the **Create Token** button                                                                                                                                                                                                                                                                                                 | This was due to not having proper EUA GitHub access.  [Resolved](DbTables.md) by [manually populating DB tables](DbTables.md#hop)                                           
| **Environment Issues** |                                          |                                                                                                                                                                                                                                                                                                                                           |                                                                                                                                                                                 |                                                   |
|                        | Starting one of the Docker containers    | Produces: <br/>`no basic auth credentials` error message                                                                                                                                                                                                                                                                                  | Re-run the `make ci-app` command in order to pull down the **ECR Docker images** from AWS.                                                                                      |                                                   |
|                        | Interacting with the API                 | Produces:  <br/>`InvalidAuthenticityToken` errors                                                                                                                                                                                                                                                                                         | Run the  `docker exec -it ${container_id}} rails dec:cache` command to turn on caching                                                                                          |                                                   |
|                        |                                          | Produces:  <br/>`401` authentication errors from the API                                                                                                                                                                                                                                                                                  | Ensure you’ve turned off authentication in the API by setting the environment variable `AUTH_DISABLED` to `true` inside the **docker-compose.yml** file              |                                                   |
|                        |                                          | Produces an error where the API seems to reject all <br/>FHIR resources and returns a blanket `500`error                                                                                                                                                                                                                                       | Tail the Attribution Service docker logs by running `docker logs -f container_id`. If you see the following error, you need to seed your local database by running make seed-db. |                                                   |
|                        | Connecting to PostGresql Database        | Service unavailable on port 5432                                                                                                                                                                                                                                                                                                          | Ensure that this code snippet is included in your **docker-compose.portals.yml** file:                                                                                          | [docker-compose.portals snippet](#docker-compose)  |
| | Issue accessing the Web Portals | Using the generated Golden Macaroon may produce an ```Invalid Base64``` error |    This is due to an additional ```%``` character added to the Macaroon in the console . This seems to be a MacOs issue, as it doesn't happen in Windows' WSL2 environment, not clear as to why. To address this, simply copy the Macaroon __without__ the last ```%``` character.    



### Code Snippets

### docker compose
```yaml
db:
   ports:
     - "5432:5432"
```
### pom xml profile node
```xml

<profile>
    <id>jdk-11-config</id>
    <activation>
        <jdk>11</jdk>
    </activation>
    <properties>
        <javadocExecutable>${java.home}/bin/javadoc</javadocExecutable>
    </properties>
</profile>
```