apache / apache/openwhisk-cli

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

Open
#150 0 comments 0 reactions 0 assignees View on GitHub
bug
Dominant language
Go
Stars
109
Forks
98
PR merge metrics
No merged PRs in 30d

Description

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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.