Hello! I'm new at deploying on Google Run. I have a strange issue. Everything was ok with my app. I haven't changed anything. And now I have an error:
```Cloud Run error: Container failed to start. Failed to start and then listen on the port defined by the PORT environment variable.```
Looks like my PostgreSQL database stopped connecting. I don't understand, what could be the reason. Does someone have some thoughts?
Solved! Go to Solution.
Hey @kmisterios - it sounds cloud run is waiting for the container to start, and it can't.
If part of the container startup process is to establish a connection to the database, and your PostgreSQL instance can't be reached or connected to by the container, then it won't be able to signal to cloudrun that it's ready and listening to connections on that Port.
How is your cloud run app connecting to the database?
You have a typo in your psql command.
It should be:
alter user postgres with password 'postgres';
You're missing the quotes around the password and the semicolon at the end. Without the semicolon, you didn't actually submit that command and hence no errors.
EDIT: so it's likely that you thought you set the password, when you actually didn't and that's why your container can't connect to the DB
Where's your Postgres DB running? Cloud SQL? On a VM? Or are you running the DB on Cloud Run?
I am trying to deploy a SQL docker image in cloud run,
But I get the following error:
ERROR: (gcloud.run.deploy) Revision 'new-sql-server-00004-cqh' is not ready and cannot serve traffic. The user-provided container failed to start and listen on the port defined provided by the PORT=1433.
I can't fix the error even though I change PORT
What do you have to tell me about deploying SQL in cloud run?
Hey @kmisterios - it sounds cloud run is waiting for the container to start, and it can't.
If part of the container startup process is to establish a connection to the database, and your PostgreSQL instance can't be reached or connected to by the container, then it won't be able to signal to cloudrun that it's ready and listening to connections on that Port.
How is your cloud run app connecting to the database?
Hi, @jkg
Thank you for your answer. You are right. I had to start the container and that was it.
Unfortunately, I have the next problem and I have no clue how to solve it. I have the following error and the same conditions. Nothing was changed in the code since the last revision.
```psycopg2.OperationalError: FATAL: password authentication failed for user "postgres"```
This time the container is started. Also, I've tried some solutions from the web and now I'm out of ideas.
It would be awesome, you could share some thoughts
If your code hasn't changed, then either your database password has, or the connection that your app is making is going to another instance. The error looks pretty clear cut to me here that it's an invalid username and password combination.
Things to check:
@jkg , everything seems correct
You have a typo in your psql command.
It should be:
alter user postgres with password 'postgres';
You're missing the quotes around the password and the semicolon at the end. Without the semicolon, you didn't actually submit that command and hence no errors.
EDIT: so it's likely that you thought you set the password, when you actually didn't and that's why your container can't connect to the DB
Thank you so much! Now everything works 🙂
User | Count |
---|---|
2 | |
1 | |
1 | |
1 | |
1 |