openwhisk-cli icon indicating copy to clipboard operation
openwhisk-cli copied to clipboard

CLI, wsk property get results in runtime error: index out of range Application exited unexpectedly error

Open jameskim0987 opened this issue 5 years ago • 8 comments

Both the wsk version from brew install wsk and the latest wsk from the releases. I have been trying to install wsk and configure to start experimenting with the framework locally. However, I'm running into a major issue. After setting apihost and auth, I wanted to see if they were set correctly so I run the command: wsk property get and the output I get is this

runtime error: index out of range 
Application exited unexpectedly

I tried removing ~/.wskprops file, reinstalling wsk but I still get the same error.

This is the output of wsk property get --debug:

[(*Client).LoadX509KeyPair]:210:[Wrn] The Cert file is not configured. Please configure the missing Cert file, if there is a security issue accessing the service.
[(*Client).LoadX509KeyPair]:219:[Wrn] The Key file is not configured. Please configure the missing Key file, if there is a security issue accessing the service.
whisk API host		http://127.0.0.1:8080
whisk auth		james
[k.(*Client).addAuthHeader]:334:[Inf] Adding basic auth header; using authkey
REQUEST:
[GET]	http://127.0.0.1:8080/api/v1/namespaces
Req Headers
{
  "Authorization": [
    "Basic amFtZXM="
  ],
  "User-Agent": [
    "OpenWhisk-CLI/1.0 (2020-05-04T04:29:27.788+0000) darwin amd64"
  ]
}
RESPONSE:Got response with code 200
Resp Headers
{
  "Cache-Control": [
    "no-cache, private"
  ],
  "Content-Length": [
    "2113"
  ],
  "Content-Type": [
    "application/json"
  ],
  "Date": [
    "Wed, 17 Jun 2020 23:35:49 GMT"
  ]
}
Response body size is 2113 bytes
Response body received:
{"kind":"NamespaceList","apiVersion":"v1","metadata":{"selfLink":"/api/v1/namespaces","resourceVersion":"497993"},"items":[{"metadata":{"name":"default","selfLink":"/api/v1/namespaces/default","uid":"be7bcfde-ce06-47c2-a4d8-1cf36bf911bf","resourceVersion":"145","creationTimestamp":"2020-06-03T23:22:20Z"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}},{"metadata":{"name":"docker","selfLink":"/api/v1/namespaces/docker","uid":"63a17d15-39fa-47ad-979d-303c9aff492f","resourceVersion":"483","creationTimestamp":"2020-06-03T23:23:34Z"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}},{"metadata":{"name":"kube-node-lease","selfLink":"/api/v1/namespaces/kube-node-lease","uid":"95c6ba59-7297-4562-98cf-09bba6008d79","resourceVersion":"36","creationTimestamp":"2020-06-03T23:22:18Z"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}},{"metadata":{"name":"kube-public","selfLink":"/api/v1/namespaces/kube-public","uid":"f3ffee51-a93a-47fb-935e-62ac86fb151f","resourceVersion":"35","creationTimestamp":"2020-06-03T23:22:18Z"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}},{"metadata":{"name":"kube-system","selfLink":"/api/v1/namespaces/kube-system","uid":"41d28d3b-3e56-4df8-94d8-fb2846843c02","resourceVersion":"32","creationTimestamp":"2020-06-03T23:22:18Z"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}},{"metadata":{"name":"kubeless","selfLink":"/api/v1/namespaces/kubeless","uid":"89ea767e-8d5d-4d6b-b0b4-3a8108e2ed14","resourceVersion":"1779","creationTimestamp":"2020-06-03T23:35:28Z"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}},{"metadata":{"name":"kubernetes-dashboard","selfLink":"/api/v1/namespaces/kubernetes-dashboard","uid":"7b8fe8c1-e578-406e-acbb-85f692b1fe52","resourceVersion":"291845","creationTimestamp":"2020-06-08T14:27:29Z","annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"v1\",\"kind\":\"Namespace\",\"metadata\":{\"annotations\":{},\"name\":\"kubernetes-dashboard\"}}\n"}},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}}]}

[o/whisk.PrintResponseInfo]:535:[Inf] Response body received (ASCII quoted string):
"{\"kind\":\"NamespaceList\",\"apiVersion\":\"v1\",\"metadata\":{\"selfLink\":\"/api/v1/namespaces\",\"resourceVersion\":\"497993\"},\"items\":[{\"metadata\":{\"name\":\"default\",\"selfLink\":\"/api/v1/namespaces/default\",\"uid\":\"be7bcfde-ce06-47c2-a4d8-1cf36bf911bf\",\"resourceVersion\":\"145\",\"creationTimestamp\":\"2020-06-03T23:22:20Z\"},\"spec\":{\"finalizers\":[\"kubernetes\"]},\"status\":{\"phase\":\"Active\"}},{\"metadata\":{\"name\":\"docker\",\"selfLink\":\"/api/v1/namespaces/docker\",\"uid\":\"63a17d15-39fa-47ad-979d-303c9aff492f\",\"resourceVersion\":\"483\",\"creationTimestamp\":\"2020-06-03T23:23:34Z\"},\"spec\":{\"finalizers\":[\"kubernetes\"]},\"status\":{\"phase\":\"Active\"}},{\"metadata\":{\"name\":\"kube-node-lease\",\"selfLink\":\"/api/v1/namespaces/kube-node-lease\",\"uid\":\"95c6ba59-7297-4562-98cf-09bba6008d79\",\"resourceVersion\":\"36\",\"creationTimestamp\":\"2020-06-03T23:22:18Z\"},\"spec\":{\"finalizers\":[\"kubernetes\"]},\"status\":{\"phase\":\"Active\"}},{\"metadata\":{\"name\":\"kube-public\",\"selfLink\":\"/api/v1/namespaces/kube-public\",\"uid\":\"f3ffee51-a93a-47fb-935e-62ac86fb151f\",\"resourceVersion\":\"35\",\"creationTimestamp\":\"2020-06-03T23:22:18Z\"},\"spec\":{\"finalizers\":[\"kubernetes\"]},\"status\":{\"phase\":\"Active\"}},{\"metadata\":{\"name\":\"kube-system\",\"selfLink\":\"/api/v1/namespaces/kube-system\",\"uid\":\"41d28d3b-3e56-4df8-94d8-fb2846843c02\",\"resourceVersion\":\"32\",\"creationTimestamp\":\"2020-06-03T23:22:18Z\"},\"spec\":{\"finalizers\":[\"kubernetes\"]},\"status\":{\"phase\":\"Active\"}},{\"metadata\":{\"name\":\"kubeless\",\"selfLink\":\"/api/v1/namespaces/kubeless\",\"uid\":\"89ea767e-8d5d-4d6b-b0b4-3a8108e2ed14\",\"resourceVersion\":\"1779\",\"creationTimestamp\":\"2020-06-03T23:35:28Z\"},\"spec\":{\"finalizers\":[\"kubernetes\"]},\"status\":{\"phase\":\"Active\"}},{\"metadata\":{\"name\":\"kubernetes-dashboard\",\"selfLink\":\"/api/v1/namespaces/kubernetes-dashboard\",\"uid\":\"7b8fe8c1-e578-406e-acbb-85f692b1fe52\",\"resourceVersion\":\"291845\",\"creationTimestamp\":\"2020-06-08T14:27:29Z\",\"annotations\":{\"kubectl.kubernetes.io/last-applied-configuration\":\"{\\\"apiVersion\\\":\\\"v1\\\",\\\"kind\\\":\\\"Namespace\\\",\\\"metadata\\\":{\\\"annotations\\\":{},\\\"name\\\":\\\"kubernetes-dashboard\\\"}}\\n\"}},\"spec\":{\"finalizers\":[\"kubernetes\"]},\"status\":{\"phase\":\"Active\"}}]}\n"
[hisk.parseSuccessResponse]:619:[Inf] Parsing HTTP response into struct type: *[]string
[hisk.parseSuccessResponse]:631:[Wrn] Unsuccessful parse of HTTP response into struct type: *[]string; parse error 'json: cannot unmarshal object into Go value of type []string'
[hisk.parseSuccessResponse]:632:[Wrn] Request was successful, so ignoring the following unexpected response body that could not be parsed: {"kind":"NamespaceList","apiVersion":"v1","metadata":{"selfLink":"/api/v1/namespaces","resourceVersion":"497993"},"items":[{"metadata":{"name":"default","selfLink":"/api/v1/namespaces/default","uid":"be7bcfde-ce06-47c2-a4d8-1cf36bf911bf","resourceVersion":"145","creationTimestamp":"2020-06-03T23:22:20Z"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}},{"metadata":{"name":"docker","selfLink":"/api/v1/namespaces/docker","uid":"63a17d15-39fa-47ad-979d-303c9aff492f","resourceVersion":"483","creationTimestamp":"2020-06-03T23:23:34Z"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}},{"metadata":{"name":"kube-node-lease","selfLink":"/api/v1/namespaces/kube-node-lease","uid":"95c6ba59-7297-4562-98cf-09bba6008d79","resourceVersion":"36","creationTimestamp":"2020-06-03T23:22:18Z"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}},{"metadata":{"name":"kube-public","selfLink":"/api/v1/namespaces/kube-public","uid":"f3ffee51-a93a-47fb-935e-62ac86fb151f","resourceVersion":"35","creationTimestamp":"2020-06-03T23:22:18Z"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}},{"metadata":{"name":"kube-system","selfLink":"/api/v1/namespaces/kube-system","uid":"41d28d3b-3e56-4df8-94d8-fb2846843c02","resourceVersion":"32","creationTimestamp":"2020-06-03T23:22:18Z"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}},{"metadata":{"name":"kubeless","selfLink":"/api/v1/namespaces/kubeless","uid":"89ea767e-8d5d-4d6b-b0b4-3a8108e2ed14","resourceVersion":"1779","creationTimestamp":"2020-06-03T23:35:28Z"},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}},{"metadata":{"name":"kubernetes-dashboard","selfLink":"/api/v1/namespaces/kubernetes-dashboard","uid":"7b8fe8c1-e578-406e-acbb-85f692b1fe52","resourceVersion":"291845","creationTimestamp":"2020-06-08T14:27:29Z","annotations":{"kubectl.kubernetes.io/last-applied-configuration":"{\"apiVersion\":\"v1\",\"kind\":\"Namespace\",\"metadata\":{\"annotations\":{},\"name\":\"kubernetes-dashboard\"}}\n"}},"spec":{"finalizers":["kubernetes"]},"status":{"phase":"Active"}}]}

[.(*NamespaceService).List]:094:[Inf] Returning []namespaces: []whisk.Namespace(nil)
[cli/commands.getNamespace]:561:[Err] Client.Namespaces.List() failed: %!s(<nil>)
runtime error: index out of range
Application exited unexpectedly

On the documentation webpage (https://openwhisk.apache.org/documentation.html), it tells me to also have the --namespace argument but I get unknown flag: --namespace so I asked on the openwhisk slack channel and someone told me to drop the --namespace flag since it is not used anymore. However, towards the end of the debug message output, it seems like there is no namespace set and I'm not sure how to fix that problem.

Could I get some help?

jameskim0987 avatar Jun 18 '20 18:06 jameskim0987

Can someone help on it? I am also getting the same issue.

archanaagrawal14 avatar Mar 03 '24 05:03 archanaagrawal14

Which OS are you guys using? I have tested with the CLI-1.2.0 on Linux and gotten no error.

style95 avatar Mar 04 '24 01:03 style95

I am using macOS. According to me, the above problem is due to not able to set namespace.

archanaagrawal14 avatar Mar 04 '24 03:03 archanaagrawal14

@archanaagrawal14 Are you using the m1 mac or amd64? Anyway, you don't need to see the namespace. The system will automatically recognize the namespace based on your auth(--auth) information.

style95 avatar Mar 04 '24 04:03 style95

Using M2 chip I am setting the auth info, but still getting the same issue mention in the above thread. I am trying to do it as guest. As guest login is still supported?

archanaagrawal14 avatar Mar 04 '24 04:03 archanaagrawal14

Are you using this version of CLI? I have tested on my m1 mac but gotten no error as well.

whisk CLI version	2021-04-01T23:49:54.523+0000

You need to configure --auth and --apihost only. Use this UUID and secret for the guest namespace.

style95 avatar Mar 04 '24 04:03 style95

When the docker stop, I am getting this image When the docker is up, image

It's showing unset cli version. Can you tell how to set that or anything else wrong?

Also, while creating the action, it shows ok action created but when checking the action list, created action is not there.

archanaagrawal14 avatar Mar 04 '24 05:03 archanaagrawal14

Have you tried with the CLI 1.2.0?

https://github.com/apache/openwhisk-cli/releases/tag/1.2.0

Are you able to run the wsk cli itself or des it exit?

macbook16:OpenWhisk_CLI-1.2.0-mac-amd64 style95$ ./wsk

        ____      ___                   _    _ _     _     _
       /\   \    / _ \ _ __   ___ _ __ | |  | | |__ (_)___| | __
  /\  /__\   \  | | | | '_ \ / _ \ '_ \| |  | | '_ \| / __| |/ /
 /  \____ \  /  | |_| | |_) |  __/ | | | |/\| | | | | \__ \   <
 \   \  /  \/    \___/| .__/ \___|_| |_|__/\__|_| |_|_|___/_|\_\
  \___\/ tm           |_|

Usage:
  wsk [command]

Available Commands:
  action      work with actions
  activation  work with activations
  api         work with APIs
  help        Help about any command
  list        list entities in the current namespace
  namespace   work with namespaces
  package     work with packages
  project     The OpenWhisk Project Management Tool
  property    work with whisk properties
  rule        work with rules
  sdk         work with the sdk
  trigger     work with triggers

Flags:
      --apihost HOST         whisk API HOST
      --apiversion VERSION   whisk API VERSION
  -u, --auth KEY             authorization KEY
      --cert string          client cert
  -d, --debug                debug level output
  -h, --help                 help for wsk
  -i, --insecure             bypass certificate checking
      --key string           client key
  -v, --verbose              verbose output

Use "wsk [command] --help" for more information about a command.

style95 avatar Mar 04 '24 08:03 style95