Skip to content

Troubleshooting ​

Most problems fall in four moments: before the first deployment, when a deployment fails, when n8n restarts, and when you remove a deployment. This page lists what was seen on real accounts and how each was fixed. Run validate first: it catches most mistakes without calling AWS. The codes are in finding codes.

The deployment fails because the CDK is not bootstrapped ​

cdk bootstrap creates, once per account and region, the bucket and roles that the CDK uses to upload files. Without it, deploy stops. deploy prints the regions to bootstrap before it starts.

bash
npx aws-cdk@2 bootstrap aws://ACCOUNT/REGION

Bootstrap the deployment region, us-east-1 when CloudFront needs a certificate or the edge login wall, and the copy region when you use backup.cross_region.

destroy stops because of deletion protection ​

When the managed database has deletion protection and environment is not dev, destroy stops with a hint. Set environment: dev or database.deletion_protection: false, run deploy again so that the change is applied, then run destroy.

n8n restarts in a loop with exit 137 ​

Exit code 137 means the container was killed for memory. n8n 2.x and its task runner share the task, and 0.5 GiB was not enough. The profiles now give nano 1 GiB and the others 2 GiB, and finding T22 warns under 1024 MiB. Raise topology.<role>.memory for the role that restarts.

I cannot find the logs of the login wall ​

The Lambda@Edge function of cloudfront-cognito runs near your users, not in your region. Its logs are in the nearest regional edge cache region: a user in Paris is served from eu-central-1 and eu-west-2, not eu-west-3. The dashboard section "Login wall" shows invocations, errors and duration for the regions of the continent. CloudWatch alarms cannot read another region, so this section has no alarm.

Something is left after destroy ​

destroy removes the stacks and keeps what holds your data: the encryption key secret, the database snapshots, the bucket and EFS (except with environment: dev), and the CDK bootstrap stack CDKToolkit. It also leaves log groups and, with cloudfront-cognito, the Lambda@Edge function, which AWS can only delete when it has removed the copies of the function at the edge, hours after the distribution is gone. A first cleanup right after destroy removes the log groups and reports that the function still has replicas: run it again hours later.

bash
n8n-on-aws cleanup -f n8n.yaml           # log groups, DNS validation record, edge function
n8n-on-aws cleanup -f n8n.yaml --purge   # also the encryption key secret and the snapshots

cleanup asks first, and without a terminal it needs --yes. --purge lists what it deletes, then deletes the secret and the snapshots, which makes the backups unreadable. For the copy region of a cross-region backup, see the restore guide.

plan or deploy refuses because of the cost ​

Finding F2 is an error when the estimate is above finops.max_monthly_usd. Run plan --cost, lower the sizes, or raise the ceiling.

The URL answers 504 ​

A 504 from CloudFront or the load balancer on a new deployment usually means that the task never became healthy. The most common cause is the memory kill described above. List the stopped tasks and read the reason of the container:

bash
aws ecs list-tasks --cluster <name> --desired-status STOPPED
aws ecs describe-tasks --cluster <name> --tasks <task-arn>

A reason such as OutOfMemoryError confirms it. If the task is running, read the log group /n8n-on-aws/<name>. A first deployment on ECS takes 12 to 17 minutes and an update 1 to 4, so wait for the stack to finish before you conclude that something is wrong.

A new deployment collides with the name of a removed one ​

destroy keeps the Lambda@Edge function <name>-edge-auth for hours. If you create a deployment with the same name before cleanup has removed it, the new stack fails. Wait and run cleanup again, or use another name.