Hello, I am testing a n8n instance running on Raiway in queue mode + 10 workers. It has been working very nice for the few days that I have been doing testing.
And then I run some custom scripting using these modules, and I would like to run them on this testing instance, but I can’t figure out how to install or allow external modules to be executed on the Code module.
You would need to make a custom image to include the packages you want to use. We don’t have any specific examples for Railway on this but we might already include both of those try adding NODE_FUNCTION_ALLOW_BUILTIN and / or NODE_FUNCTION_ALLOW_EXTERNAL and setting them to * to see if that works.
Hi @Jon I tried installing modules but I get this error:
[Region: us-west1]
=========================
Using Detected Dockerfile
=========================
context: bab22e743236f83525a05cec2950d94b
#0 building with "default" instance using docker driver
#1 [internal] load .dockerignore
#1 transferring context: 2B done
#1 DONE 0.0s
#2 [internal] load build definition from Dockerfile
#2 transferring dockerfile: 597B done
#2 DONE 0.0s
#3 [internal] load metadata for docker.io/n8nio/n8n:latest
#3 DONE 0.6s
#4 [1/3] FROM docker.io/n8nio/n8n:latest@sha256:35f27c4692019f1bf363bc15f4834d7429053e5cb9f493046495cc64936a224c
#4 DONE 0.0s
#5 [2/3] WORKDIR /usr/local/lib/node_modules/n8n
#5 CACHED
#6 [3/3] RUN npm install aws-sdk
#6 9.689 npm
Oct 16 01:56:31
ERR! code ERESOLVE
Oct 16 01:56:31
#6 9.694 npm ERR! ERESOLVE could not resolve
Oct 16 01:56:31
#6 9.694 npm ERR!
Oct 16 01:56:31
#6 9.694 npm ERR! While resolving: [email protected]
Oct 16 01:56:31
#6 9.694 npm ERR! Found: [email protected]
Oct 16 01:56:31
#6 9.694 npm ERR! node_modules/n8n-nodes-base
Oct 16 01:56:31
#6 9.694 npm ERR! n8n-nodes-base@"1.9.3" from the root project
Oct 16 01:56:31
Oct 16 01:56:31
#6 9.694 npm ERR!
Oct 16 01:56:31
#6 9.694 npm ERR! Could not resolve dependency:
Oct 16 01:56:31
#6 9.694 npm ERR! peer n8n-nodes-base@"1.9.2" from [email protected]
Oct 16 01:56:31
#6 9.695 npm ERR! node_modules/n8n-core
Oct 16 01:56:31
#6 9.695 npm ERR! n8n-core@"1.9.1" from the root project
Oct 16 01:56:31
#6 9.695 npm ERR!
Oct 16 01:56:31
#6 9.695 npm ERR! Conflicting peer dependency: [email protected]
Oct 16 01:56:31
#6 9.695 npm ERR! node_modules/n8n-nodes-base
Oct 16 01:56:31
#6 9.695 npm ERR! peer n8n-nodes-base@"1.9.2" from [email protected]
Oct 16 01:56:31
#6 9.695 npm ERR! node_modules/n8n-core
Oct 16 01:56:31
#6 9.695 npm ERR! n8n-core@"1.9.1" from the root project
Oct 16 01:56:31
#6 9.695 npm ERR!
Oct 16 01:56:31
#6 9.695 npm ERR! Fix the upstream dependency conflict, or retry
Oct 16 01:56:31
#6 9.695 npm ERR! this command with --force or --legacy-peer-deps
Oct 16 01:56:31
#6 9.695 npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
Oct 16 01:56:31
#6 9.695 npm ERR!
Oct 16 01:56:31
#6 9.695 npm ERR!
Oct 16 01:56:31
#6 9.695 npm ERR! For a full report see:
Oct 16 01:56:31
#6 9.695 npm ERR! /home/node/.npm/_logs/2023-10-15T23_56_22_676Z-eresolve-report.txt
Oct 16 01:56:31
#6 9.699
Oct 16 01:56:31
#6 9.699 npm ERR! A complete log of this run can be found in:
Oct 16 01:56:31
#6 9.699 npm ERR! /home/node/.npm/_logs/2023-10-15T23_56_22_676Z-debug-0.log
Oct 16 01:56:31
#6 ERROR: process "/bin/sh -c npm install aws-sdk" did not complete successfully: exit code: 1
Oct 16 01:56:31
-----
Oct 16 01:56:31
> [3/3] RUN npm install aws-sdk:
Oct 16 01:56:31
9.695 npm ERR! Fix the upstream dependency conflict, or retry
Oct 16 01:56:31
9.695 npm ERR! this command with --force or --legacy-peer-deps
Oct 16 01:56:31
9.695 npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
Oct 16 01:56:31
9.695 npm ERR!
Oct 16 01:56:31
9.695 npm ERR!
Oct 16 01:56:31
9.695 npm ERR! For a full report see:
Oct 16 01:56:31
9.695 npm ERR! /home/node/.npm/_logs/2023-10-15T23_56_22_676Z-eresolve-report.txt
Oct 16 01:56:31
9.699
Oct 16 01:56:31
9.699 npm ERR! A complete log of this run can be found in:
Oct 16 01:56:31
9.699 npm ERR! /home/node/.npm/_logs/2023-10-15T23_56_22_676Z-debug-0.log
Oct 16 01:56:31
-----
Oct 16 01:56:31
Oct 16 01:56:31
Dockerfile:25
Oct 16 01:56:31
-------------------
Oct 16 01:56:31
23 |
Oct 16 01:56:31
24 | # Install aws-sdk into the specified directory
Oct 16 01:56:31
25 | >>> RUN npm install aws-sdk
Oct 16 01:56:31
26 |
Oct 16 01:56:31
27 | CMD ["n8n start"]
Oct 16 01:56:31
-------------------
Oct 16 01:56:31
ERROR: failed to solve: process "/bin/sh -c npm install aws-sdk" did not complete successfully: exit code: 1
Before the npm install on the dockerfile… I feel like a dumb, hours testing different ways to install the package and everything was because of that command
CMD ["n8n" "worker"] → CMD ["worker"] ? Or you mean the command isn’t needed at all? If yes, then how the image knows it’s a worker?
About the NODE_FUNCTION_ALLOW_EXTERNAL yes I know, thanks for pointing that out, but I include that in my project variables. (I try to make my Dockerfile much dynamic as possible to make the changes in one place):