googleapis / googleapis/google-cloud-node

HTTP/2 session is closed while file beeing uploaded

Open
#7,750 1 comment 0 reactions 0 assignees View on GitHub
library: google-cloud-node-core priority: p2 type: bug
Dominant language
TypeScript
Stars
3.2k
Forks
712
Avg merge
2d 3h
Merged PRs (30d)
99

Description

I'm trying to upload files to google drive with http2 set to true
and the await on the create method is never reached (works with http2: false).

```
google.drive({
version: 'v3',
timeout: 30000,
auth,
http2: true
});

try {
const data = {
media: {
mimeType,
body: Readable.from(buffer)
},
requestBody: {
name,
parents: [directoryId]
}
};

const resp = await this.drive.files.create(data);
```

After some debugging I noticed that the http2 session is beeing destroyed after 500ms (http2.js ln:172)
If I change the 500ms to some big number then the upload process is finished succesfully
```
sessionData.timeoutHandle = setTimeout(() => {
closeSession(url);
}, 500);
```

#### Environment details

- OS: Ubuntu 20 (wsl2)
- Node.js version: v16.16.0
- npm version: v8.11.0
- `googleapis-common` version: 6.0.4

#### Steps to reproduce

1. just upload file with google drive cline with http2 set to true

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.