Failed export googledocs : This file is too large to be exported.
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
この issue はまだ評価されていません。
説明
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?
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?
- 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?
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: MacOs
- Node.js version: v18.16.1
- npm version:9.8.1
googleapisversion: 133.0.0
import { readFileSync } from 'fs';
import { google } from 'googleapis';
import path from 'path';
import { Readable } from 'stream';
export const bufferToStream = (buffer: Buffer): Readable => {
const stream = new Readable();
stream.push(buffer);
stream.push(null);
return stream;
};
export const createEmptyStream = (): Readable => {
const stream = new Readable();
stream._read = () => {};
stream.push(null);
return stream;
};
export async function downloadPDFDoc(fileId: string): Promise<Buffer> {
try {
const KEYFILEPATH = path.join(__dirname, 'happyhomes-360410-4644e17e212c.json');
const credentials = JSON.parse(readFileSync(KEYFILEPATH, 'utf8'));
const auth = new google.auth.GoogleAuth({
credentials,
scopes: ['https://www.googleapis.com/auth/drive'],
});
const drive = google.drive({
version: 'v3',
auth,
});
const response = await drive.files.export(
{
fileId: fileId,
mimeType: 'application/pdf',
},
{ responseType: 'stream' },
);
return new Promise((resolve, reject) => {
const chunks: Buffer[] = [];
response.data.on('data', (chunk: Buffer) => {
chunks.push(chunk);
});
response.data.on('end', () => {
console.log('File download completed.');
resolve(Buffer.concat(chunks));
});
response.data.on('error', (err: Error) => {
console.error('Error downloading file:', err);
reject(err);
});
});
} catch (error) {
console.error('The API returned an error: ' + error);
throw error;
}
}```
The total documents I exported were 18 MB, and when I ran this service, I got this error
```js GaxiosError: {
"error": {
"code": 400,
"message": "This file is too large to be exported.",
"errors": [
{
"message": "This file is too large to be exported.",
"domain": "global",
"reason": "badRequest",
"location": "export.size",
"locationType": "other"
}
]
}
}
at Gaxios._request (/Users/sonisuciadi/Happyhomes/rem-be/node_modules/gaxios/src/gaxios.ts:174:15)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at JWT.requestAsync (/Users/sonisuciadi/Happyhomes/rem-be/node_modules/google-auth-library/build/src/auth/oauth2client.js:405:18)
at downloadPDFDoc (/Users/sonisuciadi/Happyhomes/rem-be/src/helpers/google-docs/downloadPDFDoc.ts:57:26)
at publishOfferDocController (/Users/sonisuciadi/Happyhomes/rem-be/src/controllers/project/procurement/procurementDetailOutputJob.controllers.ts:241:32) {
config: {
url: 'https://www.googleapis.com/drive/v2/files/1G11FllbKw6qLbYJM1N8TdZpb6G2Q4QazslxsgLw9oO4/export?mimeType=application%2Fpdf',
method: 'GET',
responseType: 'stream',
userAgentDirectives: [ [Object] ],
paramsSerializer: [Function (anonymous)],
headers: {
'x-goog-api-client': 'gdcl/7.0.1 gl-node/20.6.1',
'Accept-Encoding': 'gzip',
'User-Agent': 'google-api-nodejs-client/7.0.1 (gzip)',
Authorization: 'Bearer ya29.c.c0AY_VpZi_y24RI-304tmmNmbUcghDfre0a7qnssZ_nX1xamM7YfmaxWHscd6djR88HBzBzgCLjEQLOqc_GDrGloS3jqaEMa6Pa7_R3InWNRhP8lYdjVKt5_WmFhmfeq7R9rQsLn804hB34_T1o82bW2GecegBaPF0MeDJvoAOMv-xEqb21cOUC4rBdqo-jDWGu0wrwx0otC0UBDfbRbhsrlKV75Yoe204NouUWSaEjJiMRgzOskPb2fmbDMEkTKAgsfk1J2teFrpXhbgGi4M3kStpRgAG2H8cUhTyE9ubcwcT62oIgvG3Rldfa6y0-5A04HyXR1jtHweJsFCL57zJ4jgRNICEOi6A_l1s16EaUYIk3W0CWSXpuaIE384PUel96bBbc4iO3XRimlOpYSXtorulM795V0zauSrp_wrqUozQ2UOstJMF7o8l204ei39jeFFwpI2BM_xlh54ROWt6mbwwY312qeB50aWz0M3wvxddqu3a_20x-zyokwhpMmh0fbm40IIOaFa-Y1B834BY6aUfyQwSRZq6UfO0kUyoWMah1ywmkqMV9kz75ta6ekSnY0QwroMQYbId31dMOWZuaOcaZV9Ok9OdxapZM8B1d8U-QuXORsJv_fa6IdYUgdjwz4rwFkJiM6_zSfkU200urFzOphvcdVkYoppW7mr67rSBznrwqYI0677FtJUqthfnrtJ_ZJpo-t9ougguffaQipJwjFwZmyfoS1fOubfzqatBVnurW87R2B-JlY997ob3bffMZISuQ27MXt9JM5hfYgbyRns39g57m4v6ktVOBvVq7am8w-wqse7kbi0QIa5JjYBoeetzbMu454uev27UZiumv9kIMVFo0e9kp1V-wfXqIymj-74ybm9JyQ8wmqckcI8s9O9q5hXJ2nop_9iR_tj5QqsBmSnZtlBY57MleSsgy_IXW5ktzjez9Rw2SjakQ_i0xl6pi7wZ3q5mX8o2F45vj2Mo7woJB-BhpVcvScq0Fqbv9iavFF7'
},
params: { mimeType: 'application/pdf' },
validateStatus: [Function (anonymous)],
retry: true,
errorRedactor: [Function: defaultErrorRedactor],
retryConfig: {
currentRetryAttempt: 0,
retry: 3,
httpMethodsToRetry: [Array],
noResponseRetries: 2,
statusCodesToRetry: [Array]
}
},
response: {
config: {
url: 'https://www.googleapis.com/drive/v2/files/1G11FllbKw6qLbYJM1N8TdZpb6G2Q4QazslxsgLw9oO4/export?mimeType=application%2Fpdf',
method: 'GET',
responseType: 'stream',
userAgentDirectives: [Array],
paramsSerializer: [Function (anonymous)],
headers: [Object],
params: [Object],
validateStatus: [Function (anonymous)],
retry: true,
errorRedactor: [Function: defaultErrorRedactor]
},
data: '{\n' +
' "error": {\n' +
' "code": 400,\n' +
' "message": "This file is too large to be exported.",\n' +
' "errors": [\n' +
' {\n' +
' "message": "This file is too large to be exported.",\n' +
' "domain": "global",\n' +
' "reason": "badRequest",\n' +
' "location": "export.size",\n' +
' "locationType": "other"\n' +
' }\n' +
' ]\n' +
' }\n' +
'}\n',
headers: {
'alt-svc': 'h3=":443"; ma=2592000,h3-29=":443"; ma=2592000',
'cache-control': 'private, max-age=0',
'content-length': '321',
'content-type': 'application/json; charset=UTF-8',
date: 'Wed, 28 Feb 2024 16:28:46 GMT',
expires: 'Wed, 28 Feb 2024 16:28:46 GMT',
server: 'ESF',
vary: 'Origin, X-Origin',
'x-content-type-options': 'nosniff',
'x-frame-options': 'SAMEORIGIN',
'x-guploader-uploadid': 'ABPtcPqCOaSGjiUlM-J9pa8kUkAtcLeR4NDexI63N2ecZ7dCEkTryxssJKL7HmpIDi5QJWZyPp3eaFaUew',
'x-xss-protection': '0'
},
status: 400,
statusText: 'Bad Request',
request: {
responseURL: 'https://www.googleapis.com/drive/v2/files/1G11FllbKw6qLbYJM1N8TdZpb6G2Q4QazslxsgLw9oO4/export?mimeType=application%2Fpdf'
}
},
error: undefined,
status: 400,
[Symbol(gaxios-gaxios-error)]: '6.3.0'
}
Thanks!
- 主要言語
- TypeScript
- スター
- 12.3k
- フォーク
- 2k
- 平均マージ
- 1日 19時間
- マージ済み PR(30日)
- 21
環境構築
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
googleapis/google-api-nodejs-client のほかの issue
-
難易度 5/5 1週間以上 初心者へのやさしさ 32/100
googleapis/google-api-nodejs-client#3932 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
[Discovery Engine] streamAnswer is typed as one AnswerQueryResponse, but REST returns frame arraysオープン
難易度 3/5 1〜2日 初心者へのやさしさ 64/100
googleapis/google-api-nodejs-client#3930 ·
メンテナーはふだん 1 日以内に返信
-
難易度 3/5 1〜2日 初心者へのやさしさ 76/100
googleapis/google-api-nodejs-client#3927 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
size: l type: feature request
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
googleapis/google-api-nodejs-client#3926 ·
メンテナーはふだん 1 日以内に返信
-
type: feature request
難易度 5/5 1週間以上 初心者へのやさしさ 15/100
googleapis/google-api-nodejs-client#3903 ·
メンテナーはふだん 1 日以内に返信
googleapis/google-api-nodejs-client の issue をすべて見る
似ている issue
-
documentation
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
inu-appcenter/memorIN-frontend#106 ·
メンテナーはふだん 1 日以内に返信
-
kind/bug
難易度 1/5 1時間未満 初心者へのやさしさ 88/100
メンテナーはふだん 7 日以内に返信
-
[Bug] @deck.gl/arcgis dist import resolves to unpublished @deck.gl/core source path (9.3.11, 9.4.0)オープン
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
メンテナーはふだん 1 日以内に返信
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
CSCfi/sd-search-ui#145 ·
メンテナーはふだん 1 日以内に返信
-
Add: Cbeebies pl SDオープンcheck:passed streams:add
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
メンテナーはふだん 1 日以内に返信