google-api-nodejs-client
google-api-nodejs-client copied to clipboard
Google drive: Upload timeout or server error if readable stream is takes too long
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 instead of filing on GitHub. This will ensure a timely response.
-
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.
-
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
- Do you have a support contract? No Please create an issue in the support console 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: ?
googleapisversion: latest
Steps to reproduce
-
media: { mimeType: 'video/mp2t', body:this.drive.files.create({}, 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:
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 (<anonymous>)
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' + '
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!