n8n-io / n8n

Free and source-available fair-code licensed workflow automation tool. Easily automate tasks across different services.
https://n8n.io
Other
49.29k stars 7.89k forks source link

2FA not working as container timezone does not respect GENERIC_TIMEZONE #11806

Closed wilcomir closed 2 days ago

wilcomir commented 2 days ago

Bug Description

Trying to setup 2FA on a self hosted instance of n8n fails

To Reproduce

I have setup a docker compose instance of n8n following the guide on the website. I have set the GENERIC_TIMEZONE environment variable to my timezone. I have confirmed this is propagating correctly via docker exec -it n8n printenv I have confirmed that the system datetime is wrong via docker exec -it n8n date

trying to setup 2FA fails, presumably because the n8n instance time is wrong

Expected behavior

2FA works respecting GENERIC_TIMEZONE

I suspect that I just have to either set some standard docker variables such as TZ, or bind /etc/timezone & /etc/localtime, and that what I see is somewhat expected. If this is the case, I guess the documentation should be updated to clarify this.

Operating System

docker compose

n8n Version

1.67.1

Node.js Version

unknown, whatever is in the docker

Database

SQLite (default)

Execution mode

main (default)

Joffcom commented 2 days ago

Hey @wilcomir,

We have created an internal ticket to look into this which we will be tracking as "GHC-466"

netroy commented 2 days ago

I have confirmed that the system datetime is wrong via docker exec -it n8n date

From what I understand docker containers inherit the host clock. So if date returns an invalid value, either the host clock is out of sync, or you might need to bind /etc/localtime (like you said).

Can you please check the datetime on the host?

wilcomir commented 2 days ago

Hello,

Date time on the host is correct. If the docker container needs binding of /etc/local time I think it should be in the documentation - let me try if it solves my issue.

wilcomir commented 2 days ago

Closing this issue: date/time on the host was almost correct, off by less than a minute. I fixed this and everything works as expected. As per the instructions, there is no need to mount anything, it just works.