Not logged in error

Hey, hope you’re doing great.

After updating n8n to new version, Every time I try to login I face this error: Error: Not logged in and it causes app crash.
This error occurred in: /packages/cli/src/UserManagement/route

Any idea why this happens?

Hi @jellybean, I am really sorry to hear you’re having trouble. Can you share some more details on how your set up looks like?

How are you running n8n? Which versions of n8n are you currently using and which version did your run before? Which environment variables do you have set (and to which values)? Are you injecting a JWT header by any chance?

You can also try running the n8n user-management:reset CLI command if you’re using the latest version of n8n to reset your user management database and create a new user.

1 Like

Thanks for your answer,
I’m using version 0.185.0 of n8n. I run it locally with start command and also run it with docker, when I run locally, at logout and login states I’m getting this error: Error: Not logged which is in this path: /packages/cli/src/UserManagement/route, but the app wouldn’t crash. But in server which run by docker, it crashes.

I set these variables:
DB_TYPE and its belongings
N8N_EMAIL_MODE and its belongings

and no I don’t use any jwt header or env variable.
Btw… I used this n8n user-management:reset command and tried again setting up owner and etc… but I the issue resists.

I think this error is somehow normal, Of course I’m not logged in before the login or after the logout. But not sure why it causes crash!?

Hi @jellybean, I tried firing up an n8n instance via docker with these variables set like so:

docker run -it --rm -p 5678:5678 -e N8N_HOST=localhost -e DB_TYPE=sqlite -e N8N_EMAIL_MODE=smtp -e 'NODES_INCLUDE=["n8n-nodes-base.start","n8n-nodes-base.set"]' -e 'NODES_INCLUDE=["n8n-nodes-base.function"]' -e N8N_ENCRYPTION_KEY=foo -e NODE_FUNCTION_ALLOW_BUILTIN=* -e N8N_VERSION_NOTIFICATIONS_ENABLED=false -e N8N_LOG_LEVEL=debug -e NODE_ENV=production -e EXECUTIONS_DATA_SAVE_ON_PROGRESS=false --name n8n-15822 n8nio/n8n:0.185.0

I did, however, not encounter any problem when logging in or out. Would you be able to provide the exact steps necessary to set up an environment in which your problem occurs?

1 Like

Thank you very much.
Before I provide you some details, could you please tell me if you see something like this in logs? (whenever you try to login or after logout)

Error: Not logged in
at /packages/cli/src/UserManagement/routes/auth.ts:86:19
at /packages/cli/src/ResponseHelper.ts:153:23
at Layer.handle [as handle_request] (/node_modules/express/lib/router/layer.js:95:5)
at next (/node_modules/express/lib/router/route.js:144:13)
at Route.dispatch (/node_modules/express/lib/router/route.js:114:3)
at Layer.handle [as handle_request] (/node_modules/express/lib/router/layer.js:95:5)
at /node_modules/express/lib/router/index.js:284:15
at Function.process_params (/node_modules/express/lib/router/index.js:346:12)
at next (/node_modules/express/lib/router/index.js:280:10)
at /packages/cli/src/UserManagement/routes/index.ts:137:3 {
httpStatusCode: 401

I did not, which is why I am not quite sure what causes the problem right now. I started the container using the docker run command shared above, created a user account, logged out and then logged in again.

I only got the Remove editor-UI session and Add editor-UI session entries from logging out and back in:

1 Like

Thanks MutedJam for your testings. So I will try to debug the issue and find the problem.
Thanks again :slight_smile: