Updated OpenWhisk support in The Serverless Framework

James Thomas
Apache OpenWhisk
Published in
2 min readMar 14, 2017
The Serverless Framework now has even better support for the OpenWhisk platform!

The Serverless Framework announced support for the OpenWhisk platform earlier this year. Developers can use the framework to build, deploy and manage serverless applications running on the OpenWhisk platform.

OpenWhisk has now released an updated version (0.5.0) of the provider plugin. This release adds support for Cloudant DB and IBM Message Hub events, exporting Web Actions and local OpenWhisk deployments.

Use the following command to upgrade the provider plugin to the latest version.

npm update -g serverless-openwhisk

Due to an outstanding issue with provider plugins, the OpenWhisk provider must be installed as a global module.

Here are the new features supported in the latest release….

IBM Message Hub Events

Functions can be bound to events from IBM Message Hub (“Apache Kafka”-as-a-Service) using a new event type (message_hub). Functions will be fired with the batch of messages received since the last invocation. Service credentials can be automatically read from an OpenWhisk package, removing the need for manual configuration.

functions:
index:
handler: users.main
events:
- message_hub:
topic: my_kafka_topic
package: /packageName/serviceName_Credentials

IBM Cloudant DB Events

Functions can be bound to events from IBM Cloudant (“CouchDB”-as-a-Service) using a new event type (cloudant). Functions are invoked for each database modification surfaced through the CouchDB _changes feed. Service credentials can be automatically read from an OpenWhisk package, removing the need for manual configuration.

functions:
index:
handler: users.main
events:
- cloudant:
db: my_db_name
package: /packageName/serviceName_Credentials

Export Web Actions

Functions can be turned into web actions which return HTTP content without use of an API Gateway. This feature is enabled by setting an annotation (web-export) in the configuration file.

functions:
my_function:
handler: index.main
annotations:
web-export: true

Functions with this annotation can be invoked through a URL template with the following parameters.

https://{APIHOST}/api/v1/experimental/web/{USER_NAMESPACE}/{PACKAGE}/{ACTION_NAME}.{TYPE}

Support Local OpenWhisk Deployments

This plugin now supports targeting OpenWhisk instances without valid SSL certificates. Developers running personal instances of the platform often do not have a custom SSL certificate set up for their domain.

To enable this feature, set the ignore_certs option in the serverless.yaml prior to deployment.

provider:
name: openwhisk
ignore_certs: true

Release Details & Future Plans

For full details on the features added and bugs fixed, see the milestone release on Github.

https://github.com/serverless/serverless-openwhisk/milestone/1?closed=1

If you find bugs or have feature requests, please open issues in the Github repository.

https://github.com/serverless/serverless-openwhisk

Items planned for the next release are shown in the 0.6 milestone.

https://github.com/serverless/serverless-openwhisk/milestone/2

--

--

James Thomas
Apache OpenWhisk

Developer Advocate @ IBM ☁️. Creates open-source code, talks and blogs about serverless.