apache / apache/openwhisk-cli

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

Offen
#486 8 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
Vorherrschende Sprache
Go
Sterne
109
Forks
98
PR-Merge-Kennzahlen
Keine gemergten PRs in 30 T.

Beschreibung

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()
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?

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne mit cli/commands.getNamespace und NamespaceService.List und untersuche anschließend das von whisk.parseSuccessResponse gemeldete Parsen der Antwort. Reproduziere das Problem mit `wsk property get --debug` anhand der gezeigten Namespace-Antwort und verfolge, warum die erfolgreiche Anfrage keine Namespaces liefert. Erledigt ist die Aufgabe, wenn der Befehl diese Antwort ohne einen Laufzeit-Panic verarbeitet und die konfigurierten Eigenschaften meldet.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
go
Bereich
backend, cli
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.