Building an OpenWhisk Activation Poll with Node, Vue.js and Vuetify

I've had fun building my own tools to provide additional OpenWhisk reporting utilities and today I'm releasing another one. If you find it helpful, let me know in the comments below. Even if no one else uses it, it gave me a chance to play with Vue (and Vuetify) so I had fun writing it.

The goal of this particular project was to provide a web based interface for wsk activation poll. If you aren't familiar with this utility, it lets you run a constant poll in your terminal to watch for new activations. Remember that every time you execute an OpenWhisk resource, an activation is created. This activation contains information about the execution, including how fast it ran and the result. This is how it looks in terminal:

wsk activation poll output

Not bad, but I decided to whip up something with Vue to see if I could build something nicer. I decided to give the Vuetify library a try as well. This is a library that provides Material Design components for Vue. I had a bit of trouble at first, mainly due to me doing a shoddy job of reading the docs, but once I got into it, it worked really well. I also spent some time in their Discord chat server for support, and I was incredibly impressed by the help I got there. This is definitely an active project with lots of support behind it. I think I'll be using it again in the future. Let me share a few screen shots of the final result, and then I'll dig into the code.

The application lists activations on the left hand side. This list is updated in (near) real time.

List of activations

Clicking on an individual activation loads the detail on the right:

Activation detail

I'm using Vuetify's expansion panels to compress some of the details down so they don't take as much space. Each panel can be opened and inspected. At the end of the post I'll be sharing a quick video so you can see it in action as well.

Alright, let's look at the code. First, the Node.js server.

const express = require('express');
const app = express();
const openwhisk = require('openwhisk');


const NodeCache = require('node-cache');
const activationCache = new NodeCache();

let ow = openwhisk();

app.set('port', process.env.PORT || 3000);

app.get('/activations', function(req, res) {
    let options = {
    if(req.query.ts) options.since = req.query.ts;
    ow.activations.list(options).then(result => {
        let response = => {
            activationCache.set(r.activationId, r);
            return {
        console.log('i got '+result.length+ ' activations');
        if(result.length) {
            timestamp = result[0].start+1;
        } else {
            if(req.query.ts) timestamp = req.query.ts;
            else timestamp = 0;

app.get('/activation/:id', function(req, res) {
    console.log('load activation ';
    let activation = activationCache.get(;
    if(activation) res.send(activation);

app.listen(app.get('port'), function() {
    console.log('Express running on http://localhost:' + app.get('port'));

The server makes use of Express and Node-Cache for simple RAM-based storage. I've got two end points. /activations is used to fetch activations and takes an optional argument to ask for activations after a certain timestamp. It stores the results in the cache and returns an abbreviated list of records including the name, duration, timesramp, and result of the activation.

I'm using the OpenWhisk Node package to interact with OpenWhisk. In order for this code to work on your own system, you need to ensure you've set two environment variables - __OW_API_HOST and __OW_API_KEY. If you don't remember how to get them, simply run wsk property get. The key is the whisk auth value in the output.

Finally, the other end point is /activation/:id. This simply returns the cached activation. I've got no handler for cases where an invalid id is passed so... yeah don't do that.

Ok, so now let's get to the front end. As I said, I'm using Vue and Vuetify. Let's look at the markup first.

<div id="app" v-cloak>
	<v-app dark>
			<v-toolbar-title>OpenWhisk Activation Poll</v-toolbar-title>


			<v-container grid-list-md>
				<v-layout row wrap>

					<v-flex xs4>
						<v-alert v-for="activation in activations" :key=""
						:color="activation.success?'success':'error'" value="true" transition="fade-transition" @click="loadActivation(activation)">
						{{}} ran at {{ activation.ts | formatDate }} in
						{{activation.duration}} ms

					<v-flex xs8>
						<div v-if="activation">

							<h3>{{}} ({{activation.duration}}ms)</h3>

							<v-expansion-panel expand>
								<!-- THANK YOU @zaken in the vuetify discord -->
								<v-expansion-panel-content style="overflow-x: auto" lazy>
								<div slot="header">Response</div>
								<v-expansion-panel-content style="overflow-x: auto" lazy>
								<div slot="header">Logs</div>
								<v-expansion-panel-content style="overflow-x: auto" lazy>
								<div slot="header">Annotations</div>




You can see the Vuetify components in use. For the most part I assume this is pretty readable as is. The v-flex tags are how I'm doing the two column layouts. I'm using "alert" components for the list and expansion panels for the detail. Vuetify supports a heck of a lot more so be sure to check the docs. Now let's look at the JavaScript.

Vue.filter('formatDate', function(value) {
  if (value) {
      return moment(value).format('MM/DD/YYYY [at] h:mma');

const app = new Vue({
	data() {
		return {
	created() {
		console.log('Start up, mofo!');
		getActivations() {
			.then(res => res.json())
			.then(res => {
				//this.activations = res.activations;
				console.log('num activations='+res.activations.length);
				this.activations.unshift.apply(this.activations, res.activations);
				this.last = res.ts;
				// now call again
				setTimeout(() => {
				}, 2000);

		loadActivation(act) {
			console.log('load ';
			this.activation = null;
			.then(res => res.json())
			.then(res => {
				this.activation = res;

Again, this is pretty simple. I've got little data and just a few methods. The only thing I'll call out here is my use of unshift to add to the array of activations. The idea, of course, is to add new items to the top of the array. (I think I might be doing that in the wrong order though - anyone care to comment?) In theory this could cause the memory usage of this page to skyrocket. I should add something that caps the list to 200 or so.

The complete source code for the application may be found here:

Like This?

If you like this article, please consider visiting my Amazon Wishlist or donating via PayPal to show your support. You can also subscribe to the email feed to get notified of new posts.

See Also