apache/openwhisk-client-js

Unable to create web and web-secure action

Closed this issue · 2 comments

The wsk cli offers the parameters web and web-secure to create/update actions that are reachable via https with optional secret. I haven't found an equivalent in the documentation nor in the js actions api. How can I create actions with web=true and a web secret?

The debug output of the wsk cli was very misleading as it showed the annotations that were sent to the openwhisk endpoint differently.

I found the names and values of the annotations here: https://github.com/apache/openwhisk/blob/master/docs/annotations.md#annotations-specific-to-web-actions

With these information I created the annotation like this

const annotations: openwhisk.Dict = {
    'web-export': true,
    'final': true,
    'raw-http': false,
    'require-whisk-auth': `${process.env.API_KEY}`,
};

which results in a public endpoint that is secured by an api key. I hope that this information will help those who also stumble upon the problem.

Thanks @robrat!