Hi guys,
I’m trying to build a new docker image in order to install some npm packages that I would like to use in the function node. To be more precise, I want to install firebase npm package and perhaps some more (like firebase-auth and firebase-app).
I’ll describe below what I did but my line var firebase = require('firebase');
in the javascript return this error:
VMError: Cannot find module 'firebase'
at _require (/data/node_modules/vm2/lib/sandbox.js:375:25)
at /data/packages/nodes-base/dist/nodes:3:16
at Object.<anonymous> (/data/packages/nodes-base/dist/nodes:36:15)
at NodeVM.run (/data/node_modules/vm2/lib/main.js:1167:29)
at Object.execute (/data/packages/nodes-base/nodes/Function.node.ts:104:22)
at Workflow.runNode (/data/packages/workflow/src/Workflow.ts:983:28)
at /data/packages/core/src/WorkflowExecute.ts:675:41
at processTicksAndRejections (internal/process/task_queues.js:93:5)
What I did:
-
I changed the Dockerfile in the n8n-custom folder, with the last 3 lines below:
Install all needed dependencies
RUN npm_config_user=root npm install -g full-icu
RUN npm install -g firebase
RUN npm install -g firebase-auth
RUN npm install -g firebase-app -
I did a build and pushed to my personal docker repository
docker buildx build --platform linux/amd64 --build-arg N8N_VERSION=0.126.103 -t mydockeruser/n8n:0.133.0.1 . -f docker/images/n8n-custom/Dockerfile
docker push mydockeruser/n8n:0.133.0.1 -
I put on .env at the same folder as docker-compose.yml these lines:
NODE_FUNCTION_ALLOW_EXTERNAL=firebase
NODE_FUNCTION_ALLOW_BUILTIN=firebase -
I changed in my docker-compose.yml to pick this pushed image
Am I missing something?