Problem Explanation with firebase-admin in n8n Self-Hosted Environment

Describe the problem/error/question

I am trying to integrate the firebase-admin module into my n8n workflow to connect to Firebase from a self-hosted n8n instance running on Docker. I have successfully installed firebase-admin in the Docker container, but when I try to use it in a Code node, I get an error saying that the module cannot be found. Despite the module showing as installed when I inspect the container, it fails when I try to require it inside n8n.

What is the error message (if any)?

The error message I receive is:

VMError: Cannot find module 'firebase-admin'

Please share your workflow

Share the output returned by the last node

{
  "errorMessage": "Cannot find module 'firebase-admin' [line 2, for item 0]",
  "errorDescription": "VMError",
  "errorDetails": {},
  "n8nDetails": {
    "nodeName": "Check Center firebase",
    "nodeType": "n8n-nodes-base.code",
    "nodeVersion": 2,
    "itemIndex": 0,
    "n8nVersion": "1.63.4 (Self Hosted)",
    "binaryDataMode": "default",
    "stackTrace": [
      "VMError: Cannot find module 'firebase-admin'",
      "    at Resolver.resolveFull (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/resolver.js:126:9)",
      "    at Resolver.resolve (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/resolver.js:121:15)",
      "    at resolve (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/nodevm.js:317:21)",
      "    at VM2 Wrapper.apply (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/bridge.js:490:11)",
      "    at requireImpl (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/setup-node-sandbox.js:90:19)",
      "    at require (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/setup-node-sandbox.js:171:10)",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code:2:15",
      "    at /usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Code:77:2",
      "    at VM2 Wrapper.apply (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/bridge.js:490:11)",
      "    at NodeVM.run (/usr/local/lib/node_modules/n8n/node_modules/@n8n/vm2/lib/nodevm.js:497:23)"
    ]
  }
}

Information on your n8n setup

  • n8n version: 1.63.4 (Self Hosted)
  • Database (default: SQLite): SQLite
  • n8n EXECUTIONS_PROCESS setting (default: own, main): own
  • Running n8n via (Docker, npm, n8n cloud, desktop app): Docker
  • Operating system: Ubuntu 24.04 LTS

Hi @IvannVerano

Have you set the env var NODE_FUNCTION_ALLOW_EXTERNAL ?
Here’s more on it from our docs:

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.