apache / openwhisk-client-js

JavaScript client library for the Apache OpenWhisk platform
https://openwhisk.apache.org/
Apache License 2.0
83 stars 53 forks source link

Unable to create web and web-secure action #212

Closed robrat closed 4 years ago

robrat commented 4 years ago

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?

robrat commented 4 years ago

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.

rabbah commented 4 years ago

Thanks @robrat!