Flows don't start: `[warn] Error loading flows: TypeError: Cannot read property 'hasOwnProperty' of undefined`

Hello

I am trying to setup a gitlab CI pipeline. When running starting node-red under Windows it works.
When starting under WSL (Linux) it works. When running inside Docker it works. However, with the gitlab runner it does not.

I get the unique error:

Welcome to Node-RED
===================

15 Jun 12:42:46 - [info] Node-RED version: v1.3.5-git
15 Jun 12:42:46 - [info] Node.js  version: v14.17.0
15 Jun 12:42:46 - [info] Linux 5.4.0-47-generic x64 LE
15 Jun 12:42:46 - [info] Loading palette nodes
15 Jun 12:42:52 - [info] Context store  : 'memory' [module=memory]
15 Jun 12:42:52 - [info] Context store  : 'filesystemCached' [module=localfilesystem]
15 Jun 12:42:52 - [info] Context store  : 'filesystemDirect' [module=localfilesystem]
15 Jun 12:42:52 - [info] User directory : /builds/a/b-gateway/gateway
15 Jun 12:42:52 - [info] Projects directory: /builds/a/b-gateway/gateway/projects
15 Jun 12:42:52 - [warn] Error loading flows: TypeError: Cannot read property 'hasOwnProperty' of undefined

Good, case WSL2:

Welcome to Node-RED
===================

15 Jun 16:54:19 - [info] Node-RED version: v1.3.5-git
15 Jun 16:54:19 - [info] Node.js  version: v14.17.0
15 Jun 16:54:19 - [info] Linux 4.4.0-19041-Microsoft x64 LE
15 Jun 16:54:21 - [info] Loading palette nodes
initialized
Server is now listening ... ( press CTRL+C to stop)
port  4334
 the primary server endpoint url is  opc.tcp://LAP-16.Autexis.ch:4334/UA/Sample
15 Jun 16:54:26 - [info] Context store  : 'memory' [module=memory]
15 Jun 16:54:26 - [info] Context store  : 'filesystemCached' [module=localfilesystem]
15 Jun 16:54:26 - [info] Context store  : 'filesystemDirect' [module=localfilesystem]
15 Jun 16:54:26 - [info] User directory : /mnt/c/dev/a/b-gateway/gateway
15 Jun 16:54:26 - [info] Projects directory: /mnt/c/dev/a/b-gateway/gateway/projects
Current project 'gateway-tests' is already active.
15 Jun 16:54:26 - [info] Active project : gateway-tests
15 Jun 16:54:26 - [info] Flows file     : /mnt/c/dev/a/b-gateway/gateway/projects/gateway-tests/flow.json
15 Jun 16:54:26 - [info] Starting flows
15 Jun 16:54:26 - [info] Started flows

I pinpointed the error origination somewhere to there: node_modules/@node-red/runtime/lib/flows/index.js:

function loadFlows() {
    var config;
    return storage.getFlows().then(function(_config) {
        config = _config;
        log.debug("loaded flow revision: "+config.rev);
        return credentials.load(config.credentials).then(function() {
            events.emit("runtime-event",{id:"runtime-state",retain:true});
            return config;
        });
    }).catch(function(err) {
        if (err.code === "credentials_load_failed" && !storage.projects) {
            // project disabled, credential load failed
            credentialsPendingReset = true;
            log.warn(log._("nodes.flows.error",{message:err.toString()}));
            events.emit("runtime-event",{id:"runtime-state",payload:{type:"warning",error:err.code,text:"notification.warnings.credentials_load_failed_reset"},retain:true});
            return config;
        } else {
            activeConfig = null;
            events.emit("runtime-event",{id:"runtime-state",payload:{type:"warning",error:err.code,project:err.project,text:"notification.warnings."+err.code},retain:true});
            if (err.code === "project_not_found") {
                log.warn(log._("storage.localfilesystem.projects.project-not-found",{project:err.project}));
            } else {
                log.warn(log._("nodes.flows.error",{message:err.toString()}));
            }
            throw err;
        }
    });
}

Error Message: log.warn(log._("nodes.flows.error",{message:err.toString()})); // LL86,95

But I fail to see, how or why it does not work. Maybe something with the flow.json? However, it works in all other environments...

Any idea?
Maybe also an idea, of how I could see more information about the flow loading process?

Thanks and best regards

Ok..., so after a good night sleep, I tried to disable the cache. Disabeling the cache in the .gitlab-ci.yml solved the issue. So I guess it was no problem with node-red, and only with the gitlab cache:

image: node:14

# cache only works if we make sure, that there is one runner. otherwise every runner needs to have its own cache
#cache:
#    untracked: true
#    paths:
#        - node_modules/

stages:
    - test

gateway_tests:
    before_script:
        - yarn install
    tags:
        - node
        - docker
    stage: test
    script:
        - yarn test

Since I do install everytime, i guess the cache is not really necessary

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