Railway Google Oauth Resetting

I had Gemini help me write this so I could get all the details right hopefully get some help. Thanks!!
The main symptom is that after I set up a credential (like Notion), it works for a short time. But if I then add a second credential (like Google), all previous credentials are lost and stop working.

My Setup

  • Platform: Railway.app
  • Template: The advanced n8n template with four services: Primary, Worker, Postgres, and Redis.

The Error

When the credentials drop, the deployment logs for the Primary n8n service show a recurring permission error:

Error: EACCES: permission denied, open '/home/node/.n8n/config'

What I Have Already Tried

I’ve spent many hours troubleshooting this and have tried the following steps based on documentation and help I’ve received:

  1. Persistent Volume: I have a persistent volume attached to the Primary service with the correct mount path: /home/node/.n8n.
  2. Encryption Key: I have set a long, random N8N_ENCRYPTION_KEY in the service variables.
  3. Permissions Fix (Attempt 1): I tried adding chown -R node:node /home/node/.n8n && n8n to the start command, but this failed with an Operation not permitted error, likely due to Railway’s security.
  4. Permissions Fix (Attempt 2): I set the N8N_USER environment variable to root.
  5. Clean Re-deploy: I have deleted the entire project (including the volume) and re-created it from scratch multiple times, ensuring all variables and the volume were set up before the first deployment.

Even after a complete-from-scratch deployment with the correct settings, the EACCES: permission denied error eventually returns, and credentials are lost.


My Current Variables

Here is my full list of environment variables for both the Primary and Worker services:

  • DB_TYPE: postgresdb
  • DB_POSTGRESDB_URL: ${Postgres.DATABASE_URL}
  • QUEUE_BULL_REDIS_URL: ${Redis.REDIS_URL}
  • N8N_ENCRYPTION_KEY: example_strong_key_like_this_one_123
  • WEBHOOK_URL: https://n8n.mydomain.com/
  • N8N_HOST: 0.0.0.0
  • N8N_PROTOCOL: https
  • N8N_USER: root
  • N8N_BASIC_AUTH_ACTIVE: true
  • N8N_BASIC_AUTH_USER: admin
  • N8N_BASIC_AUTH_PASSWORD: my_secure_password

My Question

What could be causing this persistent EACCES: permission denied error on Railway, even when the service is configured to run as the root user and is writing to what should be a correctly mounted persistent volume? Is there a known issue or a specific configuration for Railway’s volumes that I’m missing?