Coder Social home page Coder Social logo

Comments (8)

rabbah avatar rabbah commented on June 20, 2024 1

@brunowego I'm not sure if your error is the same. In general the OpenWhisk API key is not available to action unless you ask for it. You do this by adding the appropriate annotation on the action. See https://github.com/apache/openwhisk/blob/master/docs/annotations.md#annotations-for-all-actions

If your function is performing OpenWhisk API calls, it will need the API key and so you'll need the annotation or provide your key explicitly.

from openwhisk-catalog.

brunowego avatar brunowego commented on June 20, 2024 1

Thanks @rabbah.


After add provide-api-key works. Thanks again.

wsk action update contact/submit ./contact/submit.js \
  -a provide-api-key true \
  --web true \
  -i

from openwhisk-catalog.

rabbah avatar rabbah commented on June 20, 2024

Hi @Reylak. Thanks for the bug report.

I guess the annotation provide-api-key should read true?

Yes. This value should be set by the installation script but I don't see it. Hmm.

EDIT: it looks like we don't run countdown in the test suite. The annotation must be added here:

annotations:
description: "An action that invokes itself recursively, programmatically using whisk API"
parameters: [
{
"name": "n",
"required": false,
"description": "number of times the action needs to be invoked"
}
]
sampleInput: { "n": 5 }
sampleOutput: { "activationId": "10f95a603b6c4966b95a603b6cd96643" }
sampleLogOutput: "2018-11-12T20:27:50.12223688Z stdout: 4"

from openwhisk-catalog.

rabbah avatar rabbah commented on June 20, 2024

I don't know where does this value of false comes from though.

This is added by default for all newly created actions (by the backend controller).

from openwhisk-catalog.

brunowego avatar brunowego commented on June 20, 2024

@rabbah I'm get same issue here. Any tip? Thanks.

$ wsk action get contact/submit -i
ok: got action contact/submit
{
    "namespace": "guest/contact",
    "name": "submit",
    "version": "0.0.1",
    "exec": {
        "kind": "nodejs:10",
        "binary": false
    },
    "annotations": [
        {
            "key": "web-export",
            "value": true
        },
        {
            "key": "raw-http",
            "value": false
        },
        {
            "key": "final",
            "value": true
        },
        {
            "key": "provide-api-key",
            "value": false
        },
        {
            "key": "exec",
            "value": "nodejs:10"
        }
    ],
    "limits": {
        "timeout": 60000,
        "memory": 256,
        "logs": 10,
        "concurrency": 1
    },
    "publish": false
}
$ wsk action invoke contact/submit \
  -p name 'Bruno Wego' \
  -p email '[email protected]' \
  -p phone '1234567890' \
  -r \
  -i \
  -v
REQUEST:
[POST]	https://openwhisk.192.168.64.2.nip.io:443/api/v1/namespaces/_/actions/contact/submit?blocking=true&result=true
Req Headers
{
  "Authorization": [
    "Basic MjNiYzQ2YjEtNzFmNi00ZWQ1LThjNTQtODE2YWE0ZjhjNTAyOjEyM3pPM3haQ0xyTU42djJCS0sxZFhZRnBYbFBrY2NPRnFtMTJDZEFzTWdSVTRWck5aOWx5R1ZDR3VNREdJd1A="
  ],
  "Content-Type": [
    "application/json"
  ],
  "User-Agent": [
    "OpenWhisk-CLI/1.0 (not set) darwin amd64"
  ]
}
Req Body
{"email":"[email protected]","name":"Bruno Wego","phone":1234567890}

RESPONSE:Got response with code 502
Resp Headers
{
  "Access-Control-Allow-Headers": [
    "Authorization, Origin, X-Requested-With, Content-Type, Accept, User-Agent"
  ],
  "Access-Control-Allow-Methods": [
    "GET, DELETE, POST, PUT, HEAD"
  ],
  "Access-Control-Allow-Origin": [
    "*"
  ],
  "Connection": [
    "keep-alive"
  ],
  "Content-Length": [
    "113"
  ],
  "Content-Type": [
    "application/json"
  ],
  "Date": [
    "Tue, 01 Oct 2019 01:36:30 GMT"
  ],
  "Server": [
    "openresty/1.15.8.1"
  ],
  "X-Openwhisk-Activation-Id": [
    "0989abe2a71b404a89abe2a71bb04a94"
  ],
  "X-Request-Id": [
    "10bbbb0a0b9da5daf33902a1b4e9d11e"
  ]
}
Response body size is 113 bytes
Response body received:
{"error":"An error has occurred: Error: Invalid constructor options. Missing api_key parameter or token plugin."}
{
    "error": "An error has occurred: Error: Invalid constructor options. Missing api_key parameter or token plugin."
}

from openwhisk-catalog.

Reylak avatar Reylak commented on June 20, 2024

This [provide-api-key: false] is added by default for all newly created actions (by the backend controller).

This makes sense, and is indeed reflected in this doc about Annotations. Cited below:

provide-api-key: This annotation may be attached to actions which require an API key [...]. The absence of this annotation, or its presence with a value that is not falsy ([...]) will cause an API key to be present in the action execution context. This annotation is added to newly created actions, if not already specified, with a default false value.

(emphasis mine)

I misunderstood this paragraph at first because I stopped at the bold part. Maybe this could be rephrased?

from openwhisk-catalog.

rabbah avatar rabbah commented on June 20, 2024

Want to suggest alternate wording or open a PR?

from openwhisk-catalog.

dgrove-oss avatar dgrove-oss commented on June 20, 2024

Fixed in #310

from openwhisk-catalog.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.