Bound Packages, OpenWhisk, and Web Actions

This post is more than 2 years old.

Hey folks, this is just a warning to other users in case they run into the same issue I did. As you (may) know, OpenWhisk supports the idea of packages. Packages let you organize actions into a cohesive unit, much like packages in other languages/platforms. Packages can also have default parameters that apply to every action in the package.

Packages can also be shared, which makes them callable by other users. And even cool, you can then "bind" a package locally to yourself. Why would you do this? First, it would let you make an simpler alias of someone else's package. Second, and I think this is the big part, it lets you specify your own default parameters.

So I've got a package for ElasticSearch (you can see the code here: https://github.com/cfjedimaster/Serverless-Examples/tree/master/elasticsearch). I put this in a package called, wait for it, elasticsearch, and I then shared it publicly.

For my use, I bound it as myelasticsearch and set default parameters for my ElasticSearch authentication. Ok, so here's where things went a bit heywire. I could easily test myelasticsearch/search via my authenticated CLI calls, but I wanted to expose it as an anonymous API.

Turns out - you can't. The basic issue is that my bound copy is - essentially - an alias. While I'm allowed to overwrite default parameters, I'm not allowed to overrule the "Is this a web action" setting. I think that makes sense, but I've forgotten this twice now so that's part of the reason I'm blogging it.

So what's the fix? Rodric Rabbah (fellow IBMer) suggested a simple fix - making a sequence. A sequence is a chain of actions that acts like one action. I can then web enable that one. I could actually make a new sequence of one action and web enable it, but for the specific demo I'm doing (hopefully out on a blog post today), there is a bit of stuff I can do there to make using the API simple.

Let me know in the comments below if any of this doesn't make sense!

Raymond Camden's Picture

About Raymond Camden

Raymond is a senior developer evangelist for Adobe. He focuses on document services, JavaScript, and enterprise cat demos. If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can even buy me a coffee!

Lafayette, LA https://www.raymondcamden.com

Archived Comments

Comment 1 by Shahed Moolji posted on 5/17/2017 at 9:26 PM

Hi, I am new to OW, but it looks like currently it does not show up in the dashboard as a service. It used to a few months ago if I remember correctly. Net Result is that if you look at your dashboard, unless you know that you have OW actions, it will not be apparent !!

Comment 2 (In reply to #1) by Carlos Santana posted on 5/17/2017 at 9:36 PM

It was removed from the services. And now it's under Apps.
If you go to Catalog and type "whisk" for example it will show up.
https://uploads.disquscdn.c...

In addition now you would find it under the Main Drop Down Menu to the left
https://uploads.disquscdn.c...

Comment 3 (In reply to #2) by Shahed Moolji posted on 5/17/2017 at 10:23 PM

Thx but what I meant to say is that it does not appear under the dashboard which shows you all the services and apps you currently have running, even if you have created a few actions.

Comment 4 (In reply to #3) by Raymond Camden posted on 5/18/2017 at 11:37 AM

There is a link though. If you click the "hamburger" menu on the upper left, the nav expands and reveals a link to go to your OW actions. I'm not a UI/UX expert per se, but given the amount of info for OW and BM apps and services and stuff, to me it makes sense to not include *everything* in that initial console page.

Comment 5 (In reply to #3) by Carlos Santana posted on 5/18/2017 at 11:45 AM

Yep I understand the request, open a support ticket with your feature request.
Currently Apps refers only to cloud foundry apps and services (cf), and openwhisk has it's own dashboard here https://console.ng.bluemix....

Comment 6 (In reply to #5) by Carlos Santana posted on 5/18/2017 at 11:48 AM

It would be good ideas to display, whisk assets at that top level similar to the "Manage" tab info

Comment 7 (In reply to #6) by Raymond Camden posted on 5/18/2017 at 11:50 AM

I don't know - to me its too much info. I like the main dash being apps/services with OW having it's own page. Then again, I've got a butt ton of OW actions, maybe much more than normal.