error: Unable to invoke action using CLI when reading from file input
- Vorherrschende Sprache
- Go
- Sterne
- 109
- Forks
- 98
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Beschreibung
@csantanapr commented on [Tue Sep 13 2016](https://github.com/apache/incubator-openwhisk/issues/1248)
sequence tutorial documented doesn't work with go-cli
same tutorial works with old python cli
1. Create an action sequence so that the result of one action is passed as an argument to the next action.
```
$ wsk action create myAction --sequence /whisk.system/util/split,/whisk.system/util/sort
```
This action sequence converts some lines of text to an array, and sorts the lines.
2. Before you invoke the action sequence, create a text file called 'haiku.txt' with a few lines of text:
```
Over-ripe sushi,
The Master
Is full of regret.
```
Using go cli
```
$ wsk action invoke --blocking --result myAction --param payload "$(cat haiku.txt)"
error: Unable to invoke action 'myAction': Unable to create HTTP request for POST 'actions/myAction?blocking=true': Error encoding request body: json: error calling MarshalJSON for type *json.RawMessage: invalid character '\n' in string literal
```
Expected output:
4. Invoke the action:
```
$ wsk action invoke --blocking --result myAction --param payload "$(cat haiku.txt)"
```
```
{
"length": 3,
"lines": [
"Is full of regret.",
"Over-ripe sushi,",
"The Master"
]
}
```
---
@rabbah commented on [Tue Sep 13 2016](https://github.com/apache/incubator-openwhisk/issues/1248#issuecomment-246587944)
> error: Unable to invoke action 'myAction': Unable to create HTTP request for POST 'actions/myAction?blocking=true': Error encoding request body: json: error calling MarshalJSON for type *json.RawMessage: invalid character '\n' in string literal
The cli should do a better job reporting errors. Three levels of "[e|E]rror" and multiple : is confusing and ugly; surely can do better on the message and its formatting.
Beitragsleitfaden
Rechercherichtung
Beginne am Einstiegspunkt `wsk action invoke` und reproduziere den dokumentierten Befehl mit einer mehrzeiligen `haiku.txt`, die über `--param payload` übergeben wird. Als erledigt gilt, wenn die CLI die aus der Datei stammende Eingabe akzeptiert und das erwartete sortierte JSON-Ergebnis anstelle des gemeldeten JSON-Kodierungsfehlers erzeugt.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- go
- Bereich
- cli
- Issue-Typ
- Bug
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Größtenteils klar
- Anfängerfreundlichkeit
- 45/100