Error when upgrading to 1.25.1

I was using n8n fila normally in version 1.24.1 when I updated to version 1.25.1 it shows the following log error

Blockquote
No encryption key found - Auto-generated and saved to: /home/node/.n8n/config
Error: Missing encryption key. Worker started without the required
N8N_ENCRYPTION_KEY env var. More information: Self-hosting n8n | n8n Docs
environment-variables/configuration-methods/#encryption-key

and does not start the workers

and if I try to go back to a previous version it doesn’t start the editor with the following log error

Blockquote
Initializing n8n process
n8n ready on 0.0.0.0, port 5678
Version: 1.18.2
QueryFailedError: column cd43bc0fc97c506c5de0ef87852dc2be75e194ca.globalRoleId does not exist
at PostgresQueryRunner.query (/usr/local/lib/node_modules/n8n/node_modules/typeorm/driver/postgres/PostgresQueryRunner.js:211:19)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at SelectQueryBuilder.loadRawResults (/usr/local/lib/node_modules/n8n/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2183:25)
at SelectQueryBuilder.executeEntitiesAndRawResults (/usr/local/lib/node_modules/n8n/node_modules/typeorm/query-builder/SelectQueryBuilder.js:2034:26)
at SelectQueryBuilder.getRawAndEntities (/usr/local/lib/node_modules/n8n/node_modules/typeorm/query-builder/SelectQueryBuilder.js:684:29)
at SelectQueryBuilder.getMany (/usr/local/lib/node_modules/n8n/node_modules/typeorm/query-builder/SelectQueryBuilder.js:750:25)
at ActiveWorkflowRunner.addActiveWorkflows (/usr/local/lib/node_modules/n8n/dist/ActiveWorkflowRunner.js:378:29)
at ActiveWorkflowRunner.init (/usr/local/lib/node_modules/n8n/dist/ActiveWorkflowRunner.js:75:9)
at Start.run (/usr/local/lib/node_modules/n8n/dist/commands/start.js:242:9)
at Start._run (/usr/local/lib/node_modules/n8n/node_modules/@oclif/command/lib/command.js:43:20)
Error: Exiting due to an error.
QueryFailedError: column cd43bc0fc97c506c5de0ef87852dc2be75e194ca.globalRoleId does not exist

Information on your n8n setup

  • **n8n version:1.25.1
  • **Database (default: SQLite):Postgres 14
  • **n8n EXECUTIONS_PROCESS setting (default: own, main):QUEUE
  • **Running n8n via (Docker, npm, n8n cloud, desktop app):Docker

Hey @Diego_Lima,

Welcome to the community :partying_face:

Do you have the encryption key environment variable set for your workers?

1 Like

Yes, the same key is defined in the editor, webhook and worker, and it was working perfectly before upgrading from 1.24.1 to 1.25.1, if it wasn’t, it wouldn’t be working in version 1.24.1 either.

Hey @Diego_Lima,

Sadly I am not seeing this is my own queue instance but I am also not running 1.25.1 for it I am instead on 1.27.2, Have you tried a newer version to see if this has already been resolved?

The same error also happens for anyone between 1.25.1 and 1.27.2 and to downgrade I have to recreate some fields in the globalRoleId.user, RoleId.shared_credentials and roleId.shared.workflows database

Hey @admdiegolima,

Which issue are you referring to? For the database table we are aware of that one and it is likely because the db revert command wasn’t run.

The Encryption key message was added in 1.25 as not everyone had it configured correctly so if you are seeing that message there is a good chance there is a configuration issue.

This is my stack, could you tell me which configuration is wrong ?

Hey @admdiegolima,

That looks ok to me and it is not that different from my own configuration which is working. Did you always have the encryption key set or was that recently added? Can you also try 1.27.2 and see if that works for you?

always the N8N_ENCRYPTION_KEY configured

Interesting, That line of code is only meant to trigger if the env option is empty. Do you see that message on all of the workers?

Also have the same.

This is occurring on the main node for my setup, npm method, not docker.
Tried to install the latest stable, didn’t work, got rudder-sdk error.

Tried to then perform upgrade to 1.26.0, upgrade was successful.
But cannot start it.

Is there a manual way to correct this?
Tried to downgrade back to 1.7.1 but still the same error.

Hey @K3N,

Are you also using queue mode? I would try using 1.27.2 and make sure the env option is correctly set. As you are using npm you may need to use npm install -g --omit=dev [email protected] --ignore-scripts

Hi Jon,

Yes, running in queue mode, on AWS EC2s as a form of separation/resource management.

I will test the above next Monday, restored yesterday’s backup to get it working, lost a day worth but ehh workable.

Interestingly, it was the main node that failed to start. Worker had no issue, still doesn’t.
Even passed the encryption key as an env variable for the main node (though config was saying the same key) and still wouldn’t start, same error.
So main node running 1.7.1 and worker node running 1.26.0.

Upgraded to 1.26.0 because the experimental stack is on that version and that is running properly, and the upgrade was smooth.

Something I was confused and perhaps contributing to it though, this was the log from the worker:


Is this saying the worker is doing something to the DB? Is that GlobalAdminRole correlated with the unable to find globalRoleId column :man_shrugging: (Postgres DB and Redis on the main node EC2)

But maybe not correlated at all, I had shutdown the worker node and performed the main node upgrade and main wouldn’t come up. This screenshot was after main came up as 1.7.1 and worker I started but left as 1.26.0

Hope this helps.

Hey @K3N,

That looks like it is but the worker shouldn’t be doing that as far as I know. Is that the log from the worker or is it just general docker logs?

Hi Jon,

Yes, that’s what was strange to me.
Log from the worker, /root/.n8n/logs/n8n.log

The main node didn’t get to this, just wouldn’t start with that globalRoleId does not exist in its logs, and the postgres error.

Hey @K3N,

That sounds like something has gone horribly wrong, Can you share your config?

Hi @Jon ,

Please see attached and let me know if you have any question (yes, I am aware that is in the public address space :melting_face: the AWS VPC was set up that way by my predecessor, but the traffic is internal).
notepad++_4ssVCtWsV1


notepad++_G7NzUAe2Lt

I have yet to test the --ignore-scripts as advised above.
Also going to have a look at the Schema file again, could be due parameter changes (removed, added made new default) that’s messing with it.

But does that explain why the main node would not start at all? with the globalRoleId issue?

Thank you and kind regards,
Ken

Hey @K3N,

The globalroleid will be a database migration issue I would make sure all of your instances are on the same version and at least on 1.27.2 which should fix the database issue.

The other issue you will see is your main n8n instance does not have the encryption key env option set which is needed.

Hi @Jon ,

You are saying I needed to set the encryption key on the main node?
Never needed to before, and it was the main node that’s having trouble with the error, the worker is fine.

I manually cross-referenced the worker env variable against the main node’s config file as well, and they match.
I tested setting the env variable in the n8n.service file as well, didn’t work/

Kind regards,
Ken

Hey @K3N,

I would set the encryption key on the main instance as well just to make sure it is correct. In 1.25.0 we made a change to error if the env option didn’t match the file. The below is aken from our breaking changes document, I am not sure why this didn’t make it to the release notes, We may have updated the breaking change file after the release notes were put out.

Did you have a chance to set this and update to 1.27.2?


What changed?

If the N8N_ENCRYPTION_KEY environment variable on a main instance does not match the encryptionKey in the config file, the main instance will not initialize. If the N8N_ENCRYPTION_KEY environment variable is missing on a worker, the worker will not initialize.

When is action necessary?

If passing an N8N_ENCRYPTION_KEY environment variable to the main instance, make sure it matches the encryptionKey in the config file. If you are using workers, pass the N8N_ENCRYPTION_KEY environment variable to them.