GoogleCloudPlatform / node-red-contrib-google-cloud

Node-RED nodes for Google Cloud Platform
Apache License 2.0
90 stars 57 forks source link

problems with pubsub #54

Closed MiLaak closed 4 years ago

MiLaak commented 4 years ago

I tested https://github.com/GoogleCloudPlatform/node-red-contrib-google-cloud/blob/master/examples/PubSub.json and got it working correctly with GCP compute engine which was running node red container.

When I tried to do processing to received pubsub message I faced problems. The whole container crashed with following error: 28 Feb 13:57:19 - [red] Uncaught Exception: 28 Feb 13:57:19 - Error [ERR_HTTP2_NO_SOCKET_MANIPULATION]: HTTP/2 sockets should not be directly manipulated (e.g. read and written) at Object.get (internal/http2/core.js:814:15) at _clone (/usr/src/node-red/node_modules/clone/clone.js:162:31) at _clone (/usr/src/node-red/node_modules/clone/clone.js:175:25) at _clone (/usr/src/node-red/node_modules/clone/clone.js:162:18) at _clone (/usr/src/node-red/node_modules/clone/clone.js:162:18) at _clone (/usr/src/node-red/node_modules/clone/clone.js:162:18) at _clone (/usr/src/node-red/node_modules/clone/clone.js:162:18) at _clone (/usr/src/node-red/node_modules/clone/clone.js:162:18) at /usr/src/node-red/node_modules/clone/clone.js:141:24 at Map.forEach () npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! node-red-docker@1.0.3 start: node $NODE_OPTIONS node_modules/node-red/red.js $FLOWS "--userDir" "/data" npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the node-red-docker@1.0.3 start script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! /usr/src/node-red/.npm/_logs/2020-02-28T13_57_19_714Z-debug.log

The flow what I used attached. It is based on the above mentioned example. flow.txt

kolban-google commented 4 years ago

I have successfully recreated the issue and believe I have an understanding of the nature of the problem. I will now spend time resolving.

For your interest ... it appears that the core issue is that on a PubSub input (subscription), in your flow you have TWO wires coming out of the subscription. This should be fine and is NOT an error in any way on your part. However, what I think is happening is that when the message is received by Pub/Sub, Node-RED is "cloning" the message provided by the GCP PubSub Node libraries and I am not convinced this is legal. I am guessing that the subscription object contained in the incoming message contains "things" that are not cloneable and we fail. ... stay tuned and a test should be forthcoming soon.

kolban-google commented 4 years ago

The code has been updated and locally tested. We have committed to Github and pushed a new release to NPM and requested that node-red pick it up.

You should check this URL ...

https://flows.nodered.org/node/node-red-contrib-google-cloud

And when it says 0.0.13 release or better, we should be good to go. Please test when you can and report back.

MiLaak commented 4 years ago

Thanks for quick fix and update! Does other GCP nodes have similar issue? (I added also one review comment to your last commit)

kolban-google commented 4 years ago

I'll double check on the other GCP nodes ... but to the best of my knowledge, the Pub/Sub input was the only one that I thought to try and propagate the whole message.