Error ECS Exit Code 1

Describe the problem/error/question

ECS tasks exiting(CODE 1) with very little information

What is the error message (if any)?

log only shows this line in the cloudwatch logs

UserSettings were generated and saved to: /home/node/.n8n/config

Hey @Mikael_Boto,

Welcome to the community :cake:

I don’t really know a lot about ECS but the issue could be the database connection or the health endpoint not responding in time.

Have you treid enabling debug logging in n8n to see if that shows anything else?

Thanks for the reply, Jon.

Unfortunately I can’t access the container because it “dies” in a few seconds after getting up. So the biggest suspect would be access between him and the RDS?

Hey @Mikael_Boto,

That is my first guess yeah.

I performed several tests and I believe that it is not about permission with RDS.

I’ve troubleshooted similar situations to this in ECS - my approach has been to change the entrypoint and the command for the docker container to something simple like sleep 1000000. Then exec onto that container and try to do some local debugging IE connect to database, etc.

Edit: also have you tried setting N8N_LOG_LEVEL to debug in the environment variables?

Hey @Mikael_Boto,

What tests did you do from the n8n instance to check the permissions? My first step would be to remove the remote database options and see if it starts up this will help narrow down the issue.

What value i set this N8N_LOG_LEVEL on my environment?

I also put sleep in the container and I couldn’t find the application logs

Through an instance with the same ECS permissions I made the connection with the RDS.

I can share a screenshot tomorrow, but in your ecs task definition, you would add the environment variable, and set the value equal to “debug”.

Just an update, the container is indeed communicating with RDS

Can you set the options below.

N8N_DIAGNOSTICS_ENABLED=false
DB_LOGGING_ENABLED=true
DB_LOGGING_OPTONS=all

Here’s the log, something about database error

Hey @Mikael_Boto,

You got it, looks like the user may not be allowed access to the database from that host.

But this is a superuser that we created when performing the RDS creation

RDS is kind of tricky - I would definitely not recommend giving an application access to a db via the admin user. Best approach would be to connect to your RDS instance in PG-Admin and add a user/password. Then set the owner of that n8n database to the new user that you created

I got it guys! The error occurred because of a force_ssl from version 15 of postgres on RDS.

I set the parameter set to 0 (off)

1 Like

Nice. that would have been tricky to diagnose.