Hi all,
I'm trying to deploy my Node-RED app (with projects enabled) using Docker, but I keep running into this error on first launch:
TypeError: Cannot read properties of undefined (reading 'hasOwnProperty')
My goal is to have the project load automatically. Here's what happens:
- I pull the latest image and run the container.
- On first launch, Node-RED asks me for my username and email, then prompts me to select a project (my project appears in the list).
- After selecting the project, the error above occurs in the logs
docker logs <container-name>
- I then restart the container. It asks for username and email again, and prompts for project selection. This time, the project selection dialog stays stuck, and I see a warning like
undefined:undefined
in the UI. - I restart the container one more time, and everything works normally.
This happens every time I pull a new image and start fresh.
Any ideas on what might be causing this or how to avoid it?
Thanks in advance!
=== Files ===
The settings.js
module.exports={
"flowFile": "flows.json",
"flowFilePretty": true,
"uiPort": 1880,
"diagnostics": {
"enabled": true,
"ui": true
},
"runtimeState": {
"enabled": false,
"ui": false
},
"logging": {
"console": {
"level": "info",
"metrics": false,
"audit": false
}
},
"exportGlobalContextKeys": false,
"externalModules": {},
"editorTheme": {
"palette": {},
"projects": {
"enabled": true,
"workflow": {
"mode": "manual"
},
"activeProject": "app"
},
"codeEditor": {
"lib": "monaco",
"options": {}
},
"markdownEditor": {
"mermaid": {
"enabled": true
}
},
"multiplayer": {
"enabled": false
}
},
"functionExternalModules": true,
"functionTimeout": 0,
"functionGlobalContext": {},
"debugMaxLength": 1000,
"mqttReconnectTime": 15000,
"serialReconnectTime": 15000,
"credentialSecret": “test”
}
The Dockerfile
# Use official Node-RED base image
FROM nodered/node-red:latest
LABEL maintainer="a@a.com"
LABEL description="Test project”
WORKDIR /usr/src/node-red
# Copy your settings.js file into the image
COPY --chown=1000:1000 settings.js /data/settings.js
# Copy project files into the image
COPY --chown=1000:1000 projects/app/ /data/projects/app/
# Set working dir to /data (Node-RED's persistent volume)
WORKDIR /data
# Install custom modules from package.json
COPY --chown=1000:1000 package.json /data/projects/app/package.json
RUN npm install --unsafe-perm --no-update-notifier --no-fund || true
WORKDIR /data/projects/app
RUN git init && \
git config user.email "node-red@container.local" && \
git config user.name "Node-RED Container" && \
git config init.defaultBranch main && \
git add . && \
git commit -m "Initial project state from image build"
WORKDIR /usr/src/node-red
The flow
[
{
"id": "53492c37305c2edf",
"type": "tab",
"label": "Flow 3",
"disabled": false,
"info": "",
"env": []
},
{
"id": "8e743462ef6db302",
"type": "inject",
"z": "53492c37305c2edf",
"name": "",
"props": [
{
"p": "payload"
}
],
"repeat": "",
"crontab": "",
"once": false,
"onceDelay": 0.1,
"topic": "",
"payload": "HELLO DOCKER",
"payloadType": "str",
"x": 240,
"y": 560,
"wires": [
[
"f1eb0dc21bfdbebb"
]
]
},
{
"id": "4762323407a4dea0",
"type": "debug",
"z": "53492c37305c2edf",
"name": "debug 1",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "false",
"statusVal": "",
"statusType": "auto",
"x": 820,
"y": 520,
"wires": []
},
{
"id": "f1eb0dc21bfdbebb",
"type": "function",
"z": "53492c37305c2edf",
"name": "HELLO FROM DOCKER COMPOSE",
"func": "msg.payload = \"HELLO FROM DOCKER COMPOSE\"\nreturn msg;",
"outputs": 1,
"timeout": 0,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 530,
"y": 560,
"wires": [
[
"4762323407a4dea0"
]
]
}
]