googleapis / googleapis/google-cloud-node

createTask requires body to be a buffer

Open
#7,812 14 comments 5 reactions 1 assignee Claimed by @sofisl View on GitHub
api: cloudtasks library: google-cloud-node-core type: feature request
Dominant language
TypeScript
Stars
3.2k
Forks
712
Avg merge
2d 3h
Merged PRs (30d)
99

Description

#### Environment details

- OS: App Engine Standard Node JS
- Node.js version: 8
- npm version:
- `@google-cloud/tasks` version: 0.22.x

#### Steps to reproduce

The following code produces an "invalid encoding" error within the SDK:

```js
const url = 'https://example.com';

const client = new cloudTasks.CloudTasksClient();
const response = await client.createTask({
parent: client.queuePath(PROJECT_ID, LOCATION, QUEUE),
task: {
appEngineHttpRequest: {
httpMethod: 'POST',
relativeUri: '/audit',
body: JSON.stringify({url}),
headers: {'Content-Type': 'application/json'},
},
},
});
```

server.js:

```js
...
app.use(bodyParser.json());

app.post('/audit', async (req, resp, next) => {
let url = req.body.url; // undefined
....
});
```

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.