Troubleshooting an error on IBM cloud

Hi folks,

This is a specific question from @rtholl in another discussion, but would like to keep the other discussion focussed on heatmaps ...

Summarized: I have create an IBM cloud account and installed the node-red-contrib-ui-heatmap node.
Every time I hit the 'Deploy' button, I get this nasty error (which only appears on IBM cloud!!):

image

Problem is I have no clue how to troubleshoot this. First of all I want to determine whether this error is generated on the server side or client side (i.e. flow editor). Since it is a UI node, there is also code for a dashboard side but that shouldn't be relevant here.

I 'assume it works like this:

  1. I press the deploy button, and a call is being made to the server. That call contains a JSON with the flow (or part of the flow depending on the deploy type).
  2. Even is there is a server side error, that won't be returned in the response. I only receive a flow revision number here?
  3. If there is a server side error, this will be communicated from the server to the client via a websocket channel??

I have looked at the network traffic (via Chrome developer tools). But then I only see the modfied flow being passed to the server, and a revision number being returned:

image

  • But don't see any websocket data. Am I doing something wrong, or does this mean the error is on the client side afterwards??

  • I have no clue how to debug the server side (via chrome inspector) on IBM cloud...

  • Tried to debug from the start, so I have put a breakpoint in the onselect handler functions for every deploy button (in the red.min.js file):

    image

    But even then I never hit my breakpoints.

Does anybody have an idea where I can get started to troubleshoot this? I have run out of creativity...

if you are using a starter kit such as IoT or Node-RED starter kit I suggest opening a ticket. The most recent deployment uses node.js v10 and node-RED 0.20.5. There is a process to upgrade which support can provide the steps. Could also export all flows, delete current environment, create new (assuming ‘Lite’ which only allows 1 free instance), and import flows.

Hi @burtonboucher,

My Node-RED version on IBM cloud is 1.0.2 (so the latest version):
image

And my NodeJS version on IBM cloud (that I find via an Exec node) is 10.16.3:

I had a similar issue some time ago on older NodeJs version, but this NodeJs version should be more than recent enough...

Don't raise a ticket... the IBM starter app is community supported which means it'll end up someone asking me on slack on Monday.

Have you looked at the application logs? If there's a longer stack trace to be seen it'll be there.

No. To be honest, I have never use IBM Cloud before...
I have quickly setup an account because @rtholl reported a problem with my heatmap node in IBM Cloud...

There is no stacktrace, but now at least I know for sure that the problem is at server-side:

When I want to add some extra test code to my node:

  • Do I have to publish it on NPM (which is not really what I want)?
  • Or can I edit the heat_map.js manually somewhere?
  • Or can I execute somehow npm install bartbutenaers/node-red-contrib-ui-heatmap?

Digging a bit further into this...

  1. Have published a 2.1.3 version of my heatmap node with an updated catch section:

    function HeatMapNode(config) {
       try {
          // ...
       }
       catch (e) {
          // Server side errors
          node.error(e);
          console.trace(e)
       }
    }
    
  2. And then indeed I have finally my stacktrace in the IBM Cloud log:

    image

  3. So it goes wrong on this statement:

    image

  4. I assume that this will result afterwards in push of an undefined error...

I have added that code snippet to all my UI nodes, since it was in the first UI node example that I have seen at the time being...

Does anybody have a clue what is going on here, and how I could resolve it?

P.S. The (recent) dashboard is installed in my IBM cloud instance of Node-RED:

image

I have tried also for example the node-red-contrib-ui-level node, since that uses the same code snippet. And then I get the same error ...

For standard dashboard nodes it works fine. Could it be that none of the UI contribution nodes currently work on IBM cloud?

You'd have to check more of the startup log, but I'd expect it to work - although I can't claim to have tried to be honest.

Have you added node-red-dashboard through the palette manager or by adding it to package.json?

If you do the former, then Node-RED has to reinstall the module (and any others installed via the palette manager) whenever the app is restaged. That leads you open to timing issues if you have nodes that depend on each other - if ui-heatmap is reinstalled before dashboard, then it will hit the error you see.

If you edit package.json and restage the app, then the module will be preinstalled as part of the base application image that gets run and everything will be there when the modules are loaded and look for each other.

Yes I had installed it via the pallette manager.

Ah that explains a couple of things ...
This evening I had published a new version of my heatmap node on NPM, and updated it via the palette manager on IBM cloud. But then I got following error afterwards:

image

But as mentioned above, I use IBM cloud now for the first time (only to assist 1 single user). Have been reading a bit about it, but don't want to waste too much time on it ...

So I tried at last my own workaround to restart Node-RED hard way:

  • I logged on to the SSH panel
  • I did ps -ef to get the PID of the running node-red process
  • The I executed a kill of that PID
  • And immediately afterwards I had a Node-RED instance with my new heatmap code up and running

I assume your soft way is much better :innocent:
Will try to do it via the package.json file...

I have added the dashboard and the heatmap in the package.json (via vi command in the online SSH console):

{
    "name": "node-red-bluemix",
    "version": "1.0.0",
    "dependencies": {
        "when": "~3.x",
        "nano": "8.1.x",
        "bcrypt": "3.0.6",
        "cfenv": "~1.0.0",
        "express": "4.x",
        "body-parser": "1.x",
        "http-shutdown": "1.2.0",
        "node-red": "1.x",
        "node-red-bluemix-nodes": "1.x",
        "node-red-node-watson": "0.x",
        "node-red-node-openwhisk": "0.x",
        "node-red-node-cf-cloudant": "0.x",
        "node-red-dashboard": "2.17.1",
        "node-red-contrib-ui-heatmap": "2.1.3"
    },
    "scripts": {
        "start": "node --max-old-space-size=160 index.js --settings ./bluemix-settings.js -v"
    },
    "engines": {
        "node": "10.x"
    }
}

I assume this is now correct?

Can I somehow restage the app now easily via the SSH console or via the web ui? Installation of the Cloud Foundry CLI failed last night (:woozy_face:), but I have a bad premonition that is the only one to do it?

The changes you make by SSH'ing into the app and editing the files with vi will only survive until the app next restarts and its restores back to its built image.

The proper way to edit the settings file is either by editing it locally and using the CF/IBM CLI to push the updated application back, or to enable the Continuous Development feature via the apps IBM Cloud dashboard page - this will get you a git repo where you can edit the src of the app and deploy the changes back.

2 Likes

Hey Nick (@knolleary),
Thank you so much for this tip! Have been spending a couple of evenings on this issue...

Summarized I had to execute the following steps to get it solved:

  1. Enable the continious delivery (on my IBM cloud dashboard page):

    image

  2. Created a delivery pipeline: needed to follow some steps on the screen like generating a SSH key.

  3. In the Gitlab page I have edited the package.json file (like above)

  4. I have committed my changes and (via the webhook) the app has been restaged automatically

  5. Tested the app url and now it works:

    image

So it wasn't an error in my node after all ...

I assume that all users (like @rtholl) need to repeat those steps when they want to install UI nodes, due to the dependency to the dashboard?

3 Likes