googleapis / googleapis/google-api-nodejs-client

Google drive: Upload timeout or server error if readable stream is takes too long

Open
#3,382 0 comments 0 reactions 0 assignees View on GitHub
priority: p2 type: bug
Dominant language
TypeScript
Stars
12.2k
Forks
2k
Avg merge
1d 9h
Merged PRs (30d)
24

Description

Thanks for stopping by to let us know something could be better!

**PLEASE READ**: If you have a support contract with Google, please create an issue in the [support console](https://cloud.google.com/support/) instead of filing on GitHub. This will ensure a timely response.

1) Is this a client library issue or a product issue? Not sure
This is the client library for . We will only be able to assist with issues that pertain to the behaviors of this library. If the issue you're experiencing is due to the behavior of the product itself, please visit the [ Support page]() to reach the most relevant engineers.

2) Did someone already solve this? Not at all.
- Search the issues already opened: https://github.com/googleapis/google-api-nodejs-client/issues
- Search the issues on our "catch-all" repository: https://github.com/googleapis/google-cloud-node
- Search or ask on StackOverflow (engineers monitor these tags): http://stackoverflow.com/questions/tagged/google-cloud-platform+node.js

3) Do you have a support contract? No
Please create an issue in the [support console](https://cloud.google.com/support/) to ensure a timely response.

If the support paths suggested above still do not result in a resolution, please provide the following details.

#### Environment details

- OS: Windows 10
- Node.js version:17.9
- npm version: ?
- `googleapis` version: latest

#### Steps to reproduce

1. this.drive.files.create({
media: {
mimeType: 'video/mp2t',
body:
},
fields: 'id',
requestBody: {
name: this.url.split("/").reverse()[0] + " " + recTime.toFormat("yMMddHHmm") + ".ts",
mimeType: 'video/mp2t',
parents: ['0AKr8byAJMRKEUk9PVA']
},
supportsAllDrives: true
})
`D:\streamlink-server\node_modules\gaxios\build\src\gaxios.js:141
throw new common_1.GaxiosError(`Request failed with status code ${translatedResponse.status}`, opts, translatedResponse);
^

GaxiosError:



Error 502 (Server Error)!!1

*{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}


502. That’s an error.

The server encountered a temporary error and could not complete your request.

Please try again in 30 seconds. That’s all we know.

at Gaxios._request (D:\streamlink-server\node_modules\gaxios\build\src\gaxios.js:141:23)
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async JWT.requestAsync (D:\streamlink-server\node_modules\google-auth-library\build\src\auth\oauth2client.js:382:18) {
config: {
url: 'https://www.googleapis.com/upload/drive/v3/files?fields=id&supportsAllDrives=true&uploadType=multipart',
method: 'POST',
userAgentDirectives: [
{
product: 'google-api-nodejs-client',
version: '7.0.0',
comment: 'gzip'
}
],
paramsSerializer: [Function (anonymous)],
data: PassThrough {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [
ClientRequest {
_events: [Object: null prototype],
_eventsCount: 8,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: true,
shouldKeepAlive: false,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: false,
_headerSent: true,
_closed: false,
socket: [TLSSocket],
_header: 'POST /upload/drive/v3/files?fields=id&supportsAllDrives=true&uploadType=multipart HTTP/1.1\r\n' +
'x-goog-api-client: gdcl/7.0.0 gl-node/17.9.0\r\n' +
'content-type: multipart/related; boundary=ec4bc9a0-ee3f-427f-a373-dfb4c98ad329\r\n' +
'Accept-Encoding: gzip\r\n' +
'User-Agent: google-api-nodejs-client/7.0.0 (gzip)\r\n' +
'Authorization: Bearer ya29.c.c0AY_VpZiX4RdoDZE-FoZdKgG_l_miWmz_3634hVCzGFEgbjkH1JSXM-7sJmo541zMXqzZy9s_rMnW2lx6mGs7gu44hrYVbHHorRVkh1HUj8WA6lQ4veDBQBXRdHnYe3TTtW2lhsiRbGn1Q5M7-tx9-CT3sPa8WBG4VrXFScscz7x2YxfInbfdsfdsfdsfdsfsdf44-SIQk81\r\n' +
'Accept: */*\r\n' +
'Host: www.googleapis.com\r\n' +
'Connection: close\r\n' +
'Transfer-Encoding: chunked\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: [Agent],
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/upload/drive/v3/files?fields=id&supportsAllDrives=true&uploadType=multipart',
_ended: true,
res: [IncomingMessage],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'www.googleapis.com',
protocol: 'https:',
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
}
],
flowing: true,
ended: false,
endEmitted: false,
reading: true,
constructed: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
destroyed: false,
errored: null,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: true,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_events: [Object: null prototype] {
prefinish: [Function: prefinish],
unpipe: [Function: onunpipe],
error: [ [Function: onerror], [Function (anonymous)] ],
close: [Function: bound onceWrapper] { listener: [Function: onclose] },
finish: [Function: bound onceWrapper] { listener: [Function: onfinish] },
drain: [Function: pipeOnDrainFunctionResult],
end: [Function: bound onceWrapper] { listener: [Function: onend] },
data: [Function: ondata]
},
_eventsCount: 8,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 0,
constructed: true,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
errored: null,
closed: false,
closeEmitted: false,
[Symbol(kOnFinished)]: []
},
allowHalfOpen: true,
_flush: [Function: flush],
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
headers: {
'x-goog-api-client': 'gdcl/7.0.0 gl-node/17.9.0',
'content-type': 'multipart/related; boundary=ec4bc9a0-ee3f-427f-a373-dfb4c98ad329',
'Accept-Encoding': 'gzip',
'User-Agent': 'google-api-nodejs-client/7.0.0 (gzip)',
Authorization: 'Bearer ya29.c.c0AY_VpZiX4RdoDZE-FoZdKgG_l_miWmz_3634hVCzGFEgbjkH1JSXM-7sJmo541zMXqzZy9s_rMnW2lx6mGs7gu44hrYVbHHorRVkh1HUj8WA6lQ4veDBQBXRdHnYe3TTtW2lhsiRbGn1Q5M7-tx9-CT3sPa8WBG4VrXFScscz7x2YxfInb5YID_cgZlMPFefkVyK2gq_E8dGG7-aydymKUFg_raeT8eDlPSsB1ogRN1_iDUgfdgdfgfdgfd1'
},
params: { fields: 'id', supportsAllDrives: true, uploadType: 'multipart' },
validateStatus: [Function (anonymous)],
retry: true,
body: PassThrough {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [
ClientRequest {
_events: [Object: null prototype],
_eventsCount: 8,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
destroyed: false,
_last: true,
chunkedEncoding: true,
shouldKeepAlive: false,
maxRequestsOnConnectionReached: false,
_defaultKeepAlive: true,
useChunkedEncodingByDefault: true,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: null,
_hasBody: true,
_trailer: '',
finished: false,
_headerSent: true,
_closed: false,
socket: [TLSSocket],
_header: 'POST /upload/drive/v3/files?fields=id&supportsAllDrives=true&uploadType=multipart HTTP/1.1\r\n' +
'x-goog-api-client: gdcl/7.0.0 gl-node/17.9.0\r\n' +
'content-type: multipart/related; boundary=ec4bc9a0-ee3f-427f-a373-dfb4c98ad329\r\n' +
'Accept-Encoding: gzip\r\n' +
'User-Agent: google-api-nodejs-client/7.0.0 (gzip)\r\n' +
'Authorization: Bearer ya29.c.c0AY_VpZiX4RdoDZE-FoZdKgG_l_miWmz_3634hVCzGFEgbjkH1JSXM-7sJmo541zMXqzZy9s_rMnW2lx6mgfdgdfgdfgfJgxqJ39b7BRxJ64ab1b5yOnbiQ0WOReF_44-SIQk81\r\n' +
'Accept: */*\r\n' +
'Host: www.googleapis.com\r\n' +
'Connection: close\r\n' +
'Transfer-Encoding: chunked\r\n' +
'\r\n',
_keepAliveTimeout: 0,
_onPendingData: [Function: nop],
agent: [Agent],
socketPath: undefined,
method: 'POST',
maxHeaderSize: undefined,
insecureHTTPParser: undefined,
path: '/upload/drive/v3/files?fields=id&supportsAllDrives=true&uploadType=multipart',
_ended: true,
res: [IncomingMessage],
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
host: 'www.googleapis.com',
protocol: 'https:',
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
}
],
flowing: true,
ended: false,
endEmitted: false,
reading: true,
constructed: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
destroyed: false,
errored: null,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: true,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_events: [Object: null prototype] {
prefinish: [Function: prefinish],
unpipe: [Function: onunpipe],
error: [ [Function: onerror], [Function (anonymous)] ],
close: [Function: bound onceWrapper] { listener: [Function: onclose] },
finish: [Function: bound onceWrapper] { listener: [Function: onfinish] },
drain: [Function: pipeOnDrainFunctionResult],
end: [Function: bound onceWrapper] { listener: [Function: onend] },
data: [Function: ondata]
},
_eventsCount: 8,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 0,
constructed: true,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
errored: null,
closed: false,
closeEmitted: false,
[Symbol(kOnFinished)]: []
},
allowHalfOpen: true,
_flush: [Function: flush],
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
responseType: 'unknown',
errorRedactor: [Function: defaultErrorRedactor],
retryConfig: {
currentRetryAttempt: 0,
retry: 3,
httpMethodsToRetry: [ 'GET', 'HEAD', 'PUT', 'OPTIONS', 'DELETE' ],
noResponseRetries: 2,
statusCodesToRetry: [ [ 100, 199 ], [ 429, 429 ], [ 500, 599 ] ]
}
},
response: {
config: {
url: 'https://www.googleapis.com/upload/drive/v3/files?fields=id&supportsAllDrives=true&uploadType=multipart',
method: 'POST',
userAgentDirectives: [
{
product: 'google-api-nodejs-client',
version: '7.0.0',
comment: 'gzip'
}
],
paramsSerializer: [Function (anonymous)],
data: PassThrough {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [ [ClientRequest] ],
flowing: true,
ended: false,
endEmitted: false,
reading: true,
constructed: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
destroyed: false,
errored: null,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: true,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_events: [Object: null prototype] {
prefinish: [Function: prefinish],
unpipe: [Function: onunpipe],
error: [ [Function: onerror], [Function (anonymous)] ],
close: [Function: bound onceWrapper] {
listener: [Function: onclose]
},
finish: [Function: bound onceWrapper] {
listener: [Function: onfinish]
},
drain: [Function: pipeOnDrainFunctionResult],
end: [Function: bound onceWrapper] { listener: [Function: onend] },
data: [Function: ondata]
},
_eventsCount: 8,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 0,
constructed: true,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
errored: null,
closed: false,
closeEmitted: false,
[Symbol(kOnFinished)]: []
},
allowHalfOpen: true,
_flush: [Function: flush],
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
headers: {
'x-goog-api-client': 'gdcl/7.0.0 gl-node/17.9.0',
'content-type': 'multipart/related; boundary=ec4bc9a0-ee3f-427f-a373-dfb4c98ad329',
'Accept-Encoding': 'gzip',
'User-Agent': 'google-api-nodejs-client/7.0.0 (gzip)',
Authorization: 'Bearer ya29.c.c0AY_VpZiX4RdoDZE-FoZdKgG_l_miWmz_3634hVCzGFEgbjkH1JSXM-7sJmo541zMXqzZy9s_rMnW2lx6mGs7gu44hrYVbHHorRVkh1HUj8WA6lQ4veDBQBXRdHnYe3TTtW2lhsiRbGn1Q5M7-tx9-CT3sPa8WBG4VrXFScsctretretertBOb4_YyfB1rkFir4S51kb72i0Y3Bmq_9a5Yvltk-ZIqd40-lO56Xs3s1yajySBeaYgV0SyBU6tzoixZjhX3zdvFXrS_bmipde2ieyszJ85oQ2h88uowRXvihnUb-jSzZu1-1-UFJ8qkrMZ5zq9b4d5ey3ffa7Veo70de1eZcd_cWyiYYUibt5VISMv7cMItvscz4fWRczJ6rylWb49wSJoze43xUs02jvJ51F2zuFwtQeoV1I68ofs5bzIYg7YxVWI-ZsrR_FmbY5uhwXrg-3mB3JgxqJ39b7BRxJ64ab1b5yOnbiQ0WOReF_44-SIQk81'
},
params: {
fields: 'id',
supportsAllDrives: true,
uploadType: 'multipart'
},
validateStatus: [Function (anonymous)],
retry: true,
body: PassThrough {
_readableState: ReadableState {
objectMode: false,
highWaterMark: 16384,
buffer: BufferList { head: null, tail: null, length: 0 },
length: 0,
pipes: [ [ClientRequest] ],
flowing: true,
ended: false,
endEmitted: false,
reading: true,
constructed: true,
sync: false,
needReadable: true,
emittedReadable: false,
readableListening: false,
resumeScheduled: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
destroyed: false,
errored: null,
closed: false,
closeEmitted: false,
defaultEncoding: 'utf8',
awaitDrainWriters: null,
multiAwaitDrain: false,
readingMore: false,
dataEmitted: true,
decoder: null,
encoding: null,
[Symbol(kPaused)]: false
},
_events: [Object: null prototype] {
prefinish: [Function: prefinish],
unpipe: [Function: onunpipe],
error: [ [Function: onerror], [Function (anonymous)] ],
close: [Function: bound onceWrapper] {
listener: [Function: onclose]
},
finish: [Function: bound onceWrapper] {
listener: [Function: onfinish]
},
drain: [Function: pipeOnDrainFunctionResult],
end: [Function: bound onceWrapper] { listener: [Function: onend] },
data: [Function: ondata]
},
_eventsCount: 8,
_maxListeners: undefined,
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: false,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
buffered: [],
bufferedIndex: 0,
allBuffers: true,
allNoop: true,
pendingcb: 0,
constructed: true,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: true,
errored: null,
closed: false,
closeEmitted: false,
[Symbol(kOnFinished)]: []
},
allowHalfOpen: true,
_flush: [Function: flush],
[Symbol(kCapture)]: false,
[Symbol(kCallback)]: null
},
responseType: 'unknown',
errorRedactor: [Function: defaultErrorRedactor]
},
data: '\n' +
'\n' +
' \n' +
' \n' +
' Error 502 (Server Error)!!1\n' +
' \n' +
' *{margin:0;padding:0}html,code{font:15px/22px arial,sans-serif}html{background:#fff;color:#222;padding:15px}body{margin:7% auto 0;max-width:390px;min-height:180px;padding:30px 0 15px}* > body{background:url(//www.google.com/images/errors/robot.png) 100% 5px no-repeat;padding-right:205px}p{margin:11px 0 22px;overflow:hidden}ins{color:#777;text-decoration:none}a img{border:0}@media screen and (max-width:772px){body{background:none;margin-top:0;max-width:none;padding-right:0}}#logo{background:url(//www.google.com/images/branding/googlelogo/1x/googlelogo_color_150x54dp.png) no-repeat;margin-left:-5px}@media only screen and (min-resolution:192dpi){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat 0% 0%/100% 100%;-moz-border-image:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) 0}}@media only screen and (-webkit-min-device-pixel-ratio:2){#logo{background:url(//www.google.com/images/branding/googlelogo/2x/googlelogo_color_150x54dp.png) no-repeat;-webkit-background-size:100% 100%}}#logo{display:inline-block;height:54px;width:150px}\n' +
' \n' +
' \n' +
'

502. That’s an error.\n' +
'

The server encountered a temporary error and could not complete your request.

Please try again in 30 seconds. That’s all we know.\n',
headers: {
'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
connection: 'close',
'content-length': '1613',
'content-type': 'text/html; charset=UTF-8',
date: 'Wed, 01 Nov 2023 14:34:20 GMT',
'referrer-policy': 'no-referrer'
},
status: 502,
statusText: 'Bad Gateway',
request: {
responseURL: 'https://www.googleapis.com/upload/drive/v3/files?fields=id&supportsAllDrives=true&uploadType=multipart'
}
},
error: undefined,
status: 502
}

Node.js v17.9.0`

It'll be better if googleapis proceeds this error gracefully(reupload, resume, etc).

Making sure to follow these steps will guarantee the quickest resolution possible.

Thanks!

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.