Bug Fix: Invalid endpoint
Troubleshooting for ValueError: Invalid endpoint
1. Problem
After updating the environment variables for the
backend-flaskcontainer in thedocker-composefile, I would keep running into this issue:Invalid endpoint: https://logs..amazonaws.com
The most logical guess would be something is wrong with the AWS region configuration. The CloudWatch logs are sent over to AWS through thie CW service endpoint, which has the following structure:
logs.<YOUR_AWS_REGION>.amazonaws.com
I use
us-east-1(N. Virginia) so it should be:logs.us-east-1.amazonaws.com

2. Analysis & Solution
I tried echoing all the variables I added to the env variables for the backend in docker-compose. It turns out, AWS_DEFAULT_REGION has no value set to it.

You can assign values to environmental variables in Linux as follows:
export AWS_DEFAULT_REGION="us-east-1"
gp env AWS_DEFAULT_REGION="us-east-1" # gitpod onlyI restarted the docker-compose, however, this wouldn't fix the issue. In case you are using Gitpod, it is highly recommended that you create a brand new workspace, as this issue with updated env variables often happens with Gitpod workspaces.
3. Result
After ticking all the boxes of the list suggested in the step 2. Analysis, the CloudWatch agent correctly created a log group called cruddur.

The CloudWatch agent is diligently working on our Cruddur backend and sending over http requests to AWS CloudWatch.


Resources
Last updated