Skip to main content

openwhisk

Invokes an Apache OpenWhisk action as the upstream.

Category ServerlessAdd it to Route, Service, Consumer, Consumer group, Global rule, Plugin configEngine plugin openwhiskPriority -1901

What it does​

openwhisk answers the requests on a route by running an action on Apache OpenWhisk instead of calling an upstream. The gateway calls the platform at API host with the namespace key under Service token. It runs the Action of the Namespace, inside the Package when one is named.

When to use it​

  • An order checkout written as an action, create-order in the checkout package, published as one path of the orders API.
  • A team that already runs its handlers on OpenWhisk and wants to offer one of them to partners over HTTP.
  • One path of an API answered by an action while the rest stays on your own backend instances.

Not for a backend of your own — see Upstream (Upstreams are the backends that routes and services send traffic to), a function on OpenFunction — see openfunction (Invokes an OpenFunction function as the upstream) or code that runs inside the gateway itself — see serverless-pre-function (Runs Lua functions before the other plugins of a phase).

Set it up​

Answer each request by running an action on OpenWhisk​

The service token is the namespace key in the form user:password; the gateway sends it base64-encoded as the Basic credential.

Under Basics set API host to https://openwhisk.example.com, set Service token to <secret>, set Namespace to orders, set Action to create-order and set Package to checkout.

openwhisk · as the console saves it
{
"api_host": "https://openwhisk.example.com",
"service_token": "<secret>",
"namespace": "orders",
"package": "checkout",
"action": "create-order"
}

Things to know​

  • Namespace — A Namespace that carries a space is refused when you save, and so is a Package or an Action that does.
  • API host — An empty API host is refused when you save.
  • AdviceGive the gateway a namespace key of its own, used by no person, so that it can be withdrawn without touching anyone else's access.

Settings​

The fields as the console shows them, section by section.

Basics​

API hostapi_hoststringRequired
at least 1 character
Service tokenservice_tokenstringRequired

The namespace key, written as user:password and sent base64-encoded as the Basic credential. Stored on the engine and shown only to roles that manage this object.

NamespacenamespacestringRequired
up to 256 characters ·
pattern^([\w]|[\w][\w@.-]*[\w@.-]+)$
ActionactionstringRequired
up to 256 characters ·
pattern^([\w]|[\w][\w@.-]*[\w@.-]+)$
Packagepackagestring

Left empty, the action is looked for directly under the namespace.

up to 256 characters ·
pattern^([\w]|[\w][\w@.-]*[\w@.-]+)$

Behavior​

Resultresultbooleandefault true
Timeouttimeoutintegerdefault 3000

The same number is sent to the platform as the activation timeout.

1 to 60000 · in milliseconds
SSL verifyssl_verifybooleandefault true

Advanced​

Request body limitmax_req_body_sizeintegerdefault 67108864

The largest request body, in bytes, that is buffered in memory and forwarded. A larger body is rejected.

at least 1
Keepalivekeepalivebooleandefault true
Keepalive poolkeepalive_poolintegerdefault 5
at least 1
Keepalive timeoutkeepalive_timeoutintegerdefault 60000
at least 1000 · in milliseconds

Every plugin also has Enabled, Priority, Filter, Error response and Pre-function: see Plugin execution settings.

G8 dev · Apache APISIX® 3.19.0
Apache, Apache APISIX and APISIX are trademarks of The Apache Software Foundation.
Facts
Category
Serverless
Add it to
Route, Service, Consumer, Consumer group, Global rule, Plugin config
Engine plugin
openwhisk
Priority
-1901