Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrations failing on latest Docker image #3826

Closed
alois-gaucher opened this issue Aug 3, 2022 · 10 comments
Closed

Migrations failing on latest Docker image #3826

alois-gaucher opened this issue Aug 3, 2022 · 10 comments
Assignees

Comments

@alois-gaucher
Copy link

Describe the bug
Just after the latest update of the Docker image (n8nio/n8n:latest@sha256:3b9eb2c6996bbae3044033a4bc4c18108b6de218562ded2ae3f36f9d9aa66980), the container is unhealthy and I now have these errors in logs

2022-08-03T19:05:25+02:00	/usr/local/lib/node_modules/n8n/dist/src/databases/migrations/mysqldb/1658932910559-AddNodeIds.js:43
2022-08-03T19:05:17+02:00	    at async AddNodeIds1658932910559.up (/usr/local/lib/node_modules/n8n/dist/src/databases/migrations/mysqldb/1658932910559-AddNodeIds.js:40:9)
2022-08-03T19:05:17+02:00	    at processTicksAndRejections (node:internal/process/task_queues:96:5)
2022-08-03T19:05:17+02:00	    at runChunked (/usr/local/lib/node_modules/n8n/dist/src/databases/utils/migrationHelpers.js:75:15)
2022-08-03T19:05:17+02:00	    at /usr/local/lib/node_modules/n8n/dist/src/databases/migrations/mysqldb/1658932910559-AddNodeIds.js:41:23
2022-08-03T19:05:17+02:00	    at Array.forEach (<anonymous>)
2022-08-03T19:05:17+02:00	    at /usr/local/lib/node_modules/n8n/dist/src/databases/migrations/mysqldb/1658932910559-AddNodeIds.js:43:23
2022-08-03T19:05:17+02:00	TypeError: nodes.forEach is not a function
2022-08-03T19:05:17+02:00	                      ^
2022-08-03T19:05:17+02:00	                nodes.forEach((node) => {
2022-08-03T19:05:17+02:00	/usr/local/lib/node_modules/n8n/dist/src/databases/migrations/mysqldb/1658932910559-AddNodeIds.js:43

To Reproduce
Steps to reproduce the behavior:

  1. Update the Docker image of N8N to n8nio/n8n:latest@sha256:3b9eb2c6996bbae3044033a4bc4c18108b6de218562ded2ae3f36f9d9aa66980

Expected behavior
The migration should execute fine

Environment (please complete the following information):

  • OS: Docker (Ubuntu 22.04 LTS host)
  • n8n Version: n8nio/n8n:latest@sha256:3b9eb2c6996bbae3044033a4bc4c18108b6de218562ded2ae3f36f9d9aa66980
  • Node.js Version: 16.16.0
  • Database system: mysqldb
  • Operation mode: N/A

Additional context
Add any other context about the problem here.

@mutdmour
Copy link
Contributor

mutdmour commented Aug 4, 2022

Thanks for sharing. You seem to have an invalid workflow obj in your db. Would you be able to look into the db and tell us if the nodes object is undefined or not an array? In the meantime, will prepare a fix for this.

@alois-gaucher
Copy link
Author

I just checked my DB and the workflow_entity table seems to be correct (I validated the json of "nodes" column)
However, the installed_nodes table is empty.

The migration table contains these migrations:

'1', '1588157391238', 'InitialMigration1588157391238'
'2', '1592447867632', 'WebhookModel1592447867632'
'3', '1594902918301', 'CreateIndexStoppedAt1594902918301'
'4', '1607431743767', 'MakeStoppedAtNullable1607431743767'
'5', '1611149998770', 'AddWebhookId1611149998770'
'6', '1615306975123', 'ChangeDataSize1615306975123'
'7', '1617268711084', 'CreateTagEntity1617268711084'
'8', '1620729500000', 'ChangeCredentialDataSize1620729500000'
'9', '1620826335440', 'UniqueWorkflowNames1620826335440'
'10', '1623936588000', 'CertifyCorrectCollation1623936588000'
'11', '1626183952959', 'AddWaitColumnId1626183952959'
'12', '1630451444017', 'UpdateWorkflowCredentials1630451444017'
'13', '1644424784709', 'AddExecutionEntityIndexes1644424784709'
'14', '1646992772331', 'CreateUserManagement1646992772331'
'15', '1648740597343', 'LowerCaseUserEmail1648740597343'
'16', '1652367743993', 'AddUserSettings1652367743993'
'17', '1652905585850', 'AddAPIKeyColumn1652905585850'
'18', '1652254514003', 'CommunityNodes1652254514003'
'19', '1654090101303', 'IntroducePinData1654090101303'

@alexandervnuchkov
Copy link

I also have the same error with the latest Docker image 0.189.0 and MariaDB database. Downgrading to 0.188.0 solved the issue.
My system: host Raspbian 11 bullseye (arm64), Raspberry Pi 4 with 4 GB memory.

@mutdmour
Copy link
Contributor

mutdmour commented Aug 4, 2022

@couquino what version of MySQL are you running? Cannot reproduce with version 8. @alexandervnuchkov What version of MariaDB are you running?

@alexandervnuchkov
Copy link

@mutdmour

$ mariadb --version
mariadb  Ver 15.1 Distrib 10.9.1-MariaDB, for debian-linux-gnu (aarch64) using  EditLine wrapper

@alois-gaucher
Copy link
Author

@mutdmour (lscr.io/linuxserver/mariadb)
image

@grahamkennery
Copy link

Also receiving the same error over here with the latest update and MariaDB:
mariadb Ver 15.1 Distrib 10.5.16-MariaDB, for Linux (x86_64) using readline 5.1

My workflow_entity table has a single row, the nodes field is a valid JSON array.

@mutdmour
Copy link
Contributor

mutdmour commented Aug 4, 2022

thanks was able to reproduce it and address the issue

@floryn90
Copy link
Contributor

floryn90 commented Aug 5, 2022

hi guys,
I'm facing the same issue:

kubectl logs -n n8n n8n-9bd96d9bc-vz8xm --follow
Initializing n8n process
/usr/local/lib/node_modules/n8n/dist/src/databases/migrations/mysqldb/1658932910559-AddNodeIds.js:43
nodes.forEach((node) => {
^

TypeError: nodes.forEach is not a function
at /usr/local/lib/node_modules/n8n/dist/src/databases/migrations/mysqldb/1658932910559-AddNodeIds.js:43:23
at Array.forEach ()
at /usr/local/lib/node_modules/n8n/dist/src/databases/migrations/mysqldb/1658932910559-AddNodeIds.js:41:23
at runChunked (/usr/local/lib/node_modules/n8n/dist/src/databases/utils/migrationHelpers.js:75:15)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async AddNodeIds1658932910559.up (/usr/local/lib/node_modules/n8n/dist/src/databases/migrations/mysqldb/1658932910559-AddNodeIds.js:40:9)

Database version: "mariadb:10.8"

@janober
Copy link
Member

janober commented Aug 5, 2022

Got fixed with PR #3832 and released with [email protected]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants