The n8n Docker container is not updating the N8N_HOST
environment variable even after editing docker-compose.yml
and restarting the container. This is causing a redirect_uri_mismatch
error when trying to connect to Google Calendar OAuth2, as n8n is generating an incorrect redirect URL. I’ve checked docker-compose.yml
, the container’s interior, and tried various restart methods, but N8N_HOST
still shows the old yourdomain.com
value.
Steps I have taken to troubleshoot:
Verified that N8N_HOST
and GENERIC_OAUTH2_REDIRECT_URI
are correctly set in /root/n8n/docker-compose.yml
.
- Ensured I am restarting the container from the same directory as the
docker-compose.yml
file. - Tried stopping and removing the container (
docker stop n8n
,docker rm n8n
) before runningdocker-compose up -d
. - Checked for any globally set
N8N_HOST
environment variables on the server (env
andprintenv
). - Checked for a
.env
file inside the n8n container usingdocker exec -it n8n sh
andls -a
, but did not find a relevant.env
file in the home directory. - Tried using
docker-compose down --rmi all
beforedocker-compose up -d
. - Verified the authorized redirect URI in Google Cloud Console matches the
GENERIC_OAUTH2_REDIRECT_URI
in mydocker-compose.yml
. - Suspect the old
N8N_HOST
value might be persistent in a Docker Volume. I tried temporarily changing the volume mount indocker-compose.yml
to a new directory, but the issue persisted.