hammoaj / node-red-contrib-cloudantplus Goto Github PK
View Code? Open in Web Editor NEWEnhanced Cloudant node for Node-RED
Enhanced Cloudant node for Node-RED
Currently an invalid database connection (either not found or invalid credentials) will crash Node-RED. This is due to the recursive way that connections are retried which sets a timer to re-call the connection request, and in doing so loses the Promise chain so the error is not trapped. If max retries is set to 1, then it does work as designed as the recursive call is never made and the Promise chain remains intact.
Investigating how to re-code to ensure that the retry attempts still return the correct Promise response back to the original call.
Problem code is in https://github.com/hammoaj/node-red-contrib-cloudantplus/blob/master/modules/shared/cloudantbase.js in the connecWithRetry
function.
@Stwissel any ideas how this could be restructured to work?
The function sendDocumentOnPayload
function has been copied verbatim within the following functions:
CloudantOutNode
https://github.com/hammoaj/node-red-contrib-cloudantplus/blob/master/cloudantplus.js#L223
and
CloudantInNode
https://github.com/hammoaj/node-red-contrib-cloudantplus/blob/master/cloudantplus.js#L467
I was going to raise a PR but wasn't sure if this was a stylistic choice or not.
Feel free to close if this is by design.
/modules/shared/cloudantbase.js:292
Looks like the correct call is bulkDocuments().
Passing an array in msg.payload
is not resulting in a bulk document insert. Instead a single document is inserted with properties '0', '1', '2', etc. The node is configured for the insert operation, and to only take the msg.payload
. I have also tried passing the array as the msg
and unchecked the payload only option with no luck.
I'd like to report an interesting issue while working in a Docker context. Although, it may be worth mentioning that I'm a Node-RED newbie so there may be an easy solution for my problem.
My Node-RED Dockerfile
looks like this:
FROM nodered/node-red-docker
RUN npm install node-red-contrib-pdf-hummus
RUN npm install node-red-contrib-cloudantplus
My docker-compose.yml
looks like this:
version: '3'
services:
my-pipeline:
build: .
ports:
- "1880:1880"
volumes:
- ./data/flows.json:/data/flows.json
links:
- cloudant-developer
cloudant-developer:
image: ibmcom/cloudant-developer:latest
hostname: cloudant.dev
ports:
- "8080:80"
volumes:
- cloudant-developer:/srv
volumes:
cloudant-developer:
When I run docker-compose up
, I can see from the Node-RED logs the following issue:
my-pipeline_1 | 19 Nov 23:10:43 - [error] [cloudantplus out:insert] socket hang up
Now, there are few things I can't explain:
inject
node but the option for firing at startup is not ticked in the node configuration. So, why is the cloudantplus out
node triggered at startup?inject
node I get the same issue reported during startup (i.e. "socket hang up") but if I make a non significant change (e.g. moving some node) in order to enable the Deploy
button and then I actually re-deploy, everything works perfectly. Why a re-deploy of the exact same flow is required in order to fix the issue?As a further note, I've tried to run the same images without docker-compose by starting first Cloudant Developer and then Node-RED, giving some time to Cloudant to startup and everything worked as expected.
Ultimately, it seems that the issue is caused by the cloudant out
node trying to connect to Cloudant before the latter is actually up and running. But the worst thing is that, after the first attempt, the cloudant out
node remains in a broken state until another deploy is triggered.
Is there something that can be "fixed" in the cloudant out
node or the common approach is to ping some health endpoint of cloudant as suggested in the Docker documentation?
I installed Node-RED v2.2.2 on macOS and the cloudantplus nodes.
Observations:
Node Cloudantplus does not appear in the palette
When I configure the properties I'm prompted for user and password. On IBM Cloud I only have username, apikey etc.
I saw this tutorial, maybe it is not up-to-date (IAM?). Is there a solution?
Hi i like your project (https://flows.nodered.org/node/node-red-contrib-cloudantplus), but when i try to connect NR and Cloudant via this tutorial, i have this error (photo):
https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-creating-an-ibm-cloudant-instance-on-ibm-cloud
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.