Allowing CORS from a Node-Red Bluemix application

I wrote a rating application some time ago in Node-Red and have since needed another similar application but with slightly different behavior. So I went ahead and created a new Node-Red application on Bluemix and decided to start from scratch since it was so simple to set up. This application has three requests – Get Rating, Post Rating, and Post Comment. Here is the current flow:

Image (1) rate-flow-680x422.png for post 5391

The problem I had was the requests actually respond with JSON and I could not figure out how to enable CORS!

The first thing I did was in the Image (2) cors.png for post 5391 node I added the following to the response:

Image (3) cors2.png for post 5391

And that did not work. Then, I stumbled upon this in my Cloudant dashboard in the Account Section under CORS:


Image (4) cloudant_admin-680x212.png for post 5391

Once I checked all domains it worked fine! I am sure I can restrict the domains appropriately but I guess I don’t understand why the CORS options are under the Cloudant section and not the base application somewhere. I would think this is a specific thing to hitting the Cloudant service directly, not through a Node-Red Node. I am very interested in hearing others opinions on this.


After using the Cloudant UI to update my profile I went back and checked the bluemix-settings.js saw it indeed added the httpNodeCors line to the profile:

httpNodeCors: { origin: “*”, methods: [‘GET’,’PUT’,’POST’,’DELETE’] },

So this is clearly the issue as I saw a similar question on developerworks but saw no example of the syntax.

Searching a Cloudant DB search index with Node-Red

After much searching the internet and seeing multiple posts about this subject I can only think that many others are greatly confused with the use of the Cloudant In node in Node-Red. I think my problem was terminology and not being familiar enough with the Cloudant nomenclature more than anything and the user interface in Node needs a little more work.

I basically want to return all documents where name=XXXXX. My document is pretty simple, here is an example:


So lets start by looking at my index definition:


Now you will notice I have three references to “namesearch”:

  1. The design document name is “_design/namesearch”
  2. The Index name is “nameSearch”
  3. The index in the search index function is also named “nameSearch”

My flow takes in an HTTP request, formats it with the Selector node, and passes the query on to the Cloudant In node:


The selector node is pretty basic, after following many different instructions I finally resolved the problems with this function:


This results in a payload that looks like this:

nameSearch:Create a category layout

The Cloudant In node now has the following configuration (which seemed to be the primary problem, I will explain later:


The problem I had was I could not future out the search index fields. Mainly because this is the form when no fields are filled in:


Notice it specifically says “design document“. Now, anyone that is not familiar with this, based on my configuration, would most likely fill it out like this:

node-red cloudant in

But after scouring many documents on the internet a suggestion was to just remove the “_design/” from the first field. Which resulted in the correct version I have above:


Needless to say this actually took me hours to figure out because I thought it was something with the query being passed in!

If you are not familiar with Node-Red then click this link.

Brilliant idea at!

For sessions, they passed out USB chargers that you return when the session is over. Brilliant!



IBM WebSphere Commerce v8 is here at last!


In case you missed the announcement, IBM just announced WebSphere Commerce v8!

There are going to be a lot of posts over the next month on the many new features in this release. I am most excited for two particularly interesting features, the first one is the new customer service representative features (CSR):

WebSphere Commerce V8.0 provides new customer service enhancements with Customer Service for WebSphere Commerce that enable a customer service representative (CSR) to resolve common issues and capture orders. These new capabilities are built into the WebSphere Commerce V8.0 storefront and enable a CSR to perform key tasks on behalf of a guest, registered customers, and for both B2B and B2C business models. Customer Service for WebSphere Commerce is offered for both Professional and Enterprise editions. – link

And of course the next is the long anticipated IBM Commerce Insights which:

IBM intends to deliver Commerce Insights in 2015, as a separately orderable, software as a service (SaaS) offering that can be used with your on premises or on cloud deployment of IBM WebSphere Commerce V8.0. – link

Now that all sounds great but some other important things to know is WebSphere Commerce now supports WAS ND 8.5, DB2 10.5 and of course RAD 9.5 for development.
But the developer in me is really excited because WebSphere Commerce Management Center now leverages dynamic HTML (DHTML) and the open source framework Spring. Which means extending the WebSphere Commerce tooling will be much easier going forward. Woo Hoo!
This really is a great release and I can’t wait to share all of the great features, stay tuned!