CCF API for AWS running in docker with credentials error

47 views
Skip to first unread message

Yann Bounya

unread,
Dec 12, 2023, 9:29:20 AM12/12/23
to Cloud Carbon Footprint
Hi CCF team, hope you're doing well.

I'm trying to run the CCF API in a docker container on AWS EC2.

here's the query I send and the error message I get in the logs


```
2023-12-11T10:01:40.581Z [App] info: Starting AWS Estimations
2023-12-11T10:01:40.583Z [api] error: Unable to process footprint request.TypeError: Cannot read properties of null (reading 'credentials')
    at new Credentials (/usr/src/app/node_modules/aws-sdk/lib/credentials.js:73:32)
    at AWSCredentialsProvider.create (/usr/src/app/node_modules/@cloud-carbon-footprint/aws/dist/application/AWSCredentialsProvider.js:33:24)
    at new AWSAccount (/usr/src/app/node_modules/@cloud-carbon-footprint/aws/dist/application/AWSAccount.js:39:61)
    at Object.getCostAndEstimates (/usr/src/app/node_modules/@cloud-carbon-footprint/app/dist/App.js:40:41)
    at getCostAndEstimates (/usr/src/app/node_modules/@cloud-carbon-footprint/app/dist/Cache.js:22:72)
    at /usr/src/app/node_modules/@cloud-carbon-footprint/app/dist/Cache.js:50:16
    at Array.map (<anonymous>)
    at getEstimatesForMissingDates (/usr/src/app/node_modules/@cloud-carbon-footprint/app/dist/Cache.js:49:76)
    at descriptor.value (/usr/src/app/node_modules/@cloud-carbon-footprint/app/dist/Cache.js:33:38)
    at async FootprintApiMiddleware (/usr/src/app/dist/middleware.js:30:35)
```

- I've configured the `.env` with appropriate config, as far as I can tell, and then run the create_docker_secrets.sh to generate the secrets.
- can tell that the container has access to the secrets by running

```
[root@ip-10-14-35-185 ec2-user]# docker container exec $(docker ps --filter name=cloud-carbon-footprint-api-1 -q) ls -l /run/secrets
total 60
-rw-r--r--    1 root     root            35 Dec 12 04:34 AWS_ATHENA_DB_NAME
-rw-r--r--    1 root     root            22 Dec 12 04:34 AWS_ATHENA_DB_TABLE
-rw-r--r--    1 root     root            27 Dec 12 04:34 AWS_ATHENA_QUERY_RESULT_LOCATION
-rw-r--r--    1 root     root            15 Dec 12 04:34 AWS_ATHENA_REGION
-rw-r--r--    1 root     root            24 Dec 12 04:34 AWS_BILLING_ACCOUNT_ID
-rw-r--r--    1 root     root            26 Dec 12 04:34 AWS_BILLING_ACCOUNT_NAME
-rw-r--r--    1 root     root             8 Dec 12 04:34 AWS_TARGET_ACCOUNT_ROLE_NAME
-rw-r--r--    1 root     root            21 Dec 12 04:34 AZURE_CLIENT_ID
-rw-r--r--    1 root     root            25 Dec 12 04:34 AZURE_CLIENT_SECRET
-rw-r--r--    1 root     root            21 Dec 12 04:34 AZURE_TENANT_ID
-rw-r--r--    1 root     root            26 Dec 12 04:34 GCP_BIG_QUERY_TABLE
-rw-r--r--    1 root     root            24 Dec 12 04:34 GCP_BILLING_PROJECT_ID
-rw-r--r--    1 root     root            26 Dec 12 04:34 GCP_BILLING_PROJECT_NAME
-rw-r--r--    1 root     root            30 Dec 12 04:34 MONGODB_CREDENTIALS
-rw-r--r--    1 root     root            26 Dec 12 04:34 MONGODB_URI
```
and I can tell that the values are populated as well. I'm wondering what I am doing wrong and what's the best next step for troubleshooting here

Thanks,



Cloud Carbon Footprint

unread,
Feb 22, 2024, 2:15:44 PMFeb 22
to Cloud Carbon Footprint
Hello,

Apologies for the late reply! Are you still having this issue?

The error seems to be pointing out that AWS can't properly establish credentials for the provided account. We would suggest double checking that your AWS Authentication option is configured properly and that it is recognizing the appropriate env variable that the method relies on.

Best,
The CCF Team at Thoughtworks

Reply all
Reply to author
Forward
0 new messages