apache / apache/openwhisk-cli

error: Unable to invoke action using CLI when reading from file input

Aperta
#150 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub
bug
Lingua principale
Go
Stelle
109
Fork
98
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

@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.

Guida per i contributori

Apri la guida per i contributori

Direzione di ricerca

Inizia dal punto di ingresso `wsk action invoke` e riproduci il comando documentato passando un `haiku.txt` multilinea tramite `--param payload`. Il lavoro è completato quando la CLI accetta l’input derivato dal file e produce il risultato JSON ordinato previsto invece dell’errore di codifica JSON segnalato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
go
Ambito
cli
Tipo di issue
Bug
Difficoltà
3/5
Tempo stimato
1-2 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
45/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.