Skip to main content

openwhisk

openwhisk

Invokes an Apache OpenWhisk action and returns the action's reply as the gateway response. It replaces the upstream: place it where an upstream node would go and wire its success port straight to client.in.

Configuration

KeyTypeDefaultDescription
api_hoststringrequiredOpenWhisk API host, e.g. https://ow.example.com.
service_tokenstringrequireduser:pass action token, sent base64-encoded as HTTP Basic auth.
actionstringrequiredAction name to invoke.
namespacestring_OpenWhisk namespace.
packagestringPackage the action belongs to.
resultbooltrueRequest result=true (inline the action result rather than the full activation record).
ssl_verifybooltrueVerify TLS certificates on the callout.
timeoutinteger (ms)3000Whole-call deadline, also passed as the action timeout query parameter.
type: openwhisk
config:
api_host: https://ow.example.com
service_token: ${OPENWHISK_TOKEN}
namespace: guest
action: hello
result: true
ssl_verify: true
timeout: 3000

Config load fails if api_host, service_token, or action is missing/empty.

Behavior

The plugin POSTs the client request body as the action parameters to <api_host>/api/v1/namespaces/<namespace>/actions/<package/><action>?blocking=true&result=<result>&timeout=<ms> with Authorization: Basic <base64(service_token)> and Content-Type: application/json. On success it populates context.response and exits through the success port — which should be wired to client.in, since this node stands in for the upstream.

Response mapping

OpenWhisk returns a JSON envelope. An action may return just a body, or set statusCode and headers explicitly:

  • statusCode (when present) becomes the response status; otherwise the transport status is used.
  • headers (when present) are applied to the response.
  • body (string or nested JSON) becomes the response body; when absent, the raw envelope is passed through.

A non-JSON, non-empty envelope fails the node with 503.

A callout failure or an unparseable envelope returns the Context along with an error routed through the error port; the error is appended to context.errors — see Errors.

The plugin does not read or write context.message.

Errors

The node returns the Context with an error, so the graph engine routes through the error port and appends the error to context.errors. The status below is the one prepared on context.response; wire error to client (or an error-handler) for the caller to see it.

CodeStatusWhen
OPENWHISK_CALLOUT_ERROR504The action callout exceeded timeout.
OPENWHISK_CALLOUT_ERROR503Connecting to or exchanging with the endpoint failed.
OPENWHISK_CALLOUT_ERROR502The request could not be built (e.g. an invalid endpoint URI).
OPENWHISK_CALLOUT_ERROR503The activation response could not be read.