googleapis / googleapis/google-cloud-node
createTask requires body to be a buffer
- 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
Assessment
This issue has not been assessed yet.