Google Drive | 500 Unknown Error Yet File Still Created
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- google-cloud, node.js, typescript
Research direction
Start with the uploadFileToGoogleDrive entry point shown in the issue and reproduce the client.files.create call using the listed Node.js, googleapis, and macOS versions. Inspect the request and error/response behavior when the file is created despite the 500; done means the misleading failure is explained and the expected upload result is established.
Written by the indexing model from the issue text.
Description
An 'Unknown Error' with code 500 keeps returning when using the Node SDK and google drive to upload a file.
I have tested that my OAuth client is working as I am able to retrieve file metadata from the drive. However, when I go to run the upload script below I get a 500 error, despite the file actually being created in Google Drive...
Environment details
- OS: MacOS 14.5
- Node.js version: v22.4.1
googleapisversion: ^134.0.0
Steps to reproduce
Error Message
Google Drive API Error: {
code: 500,
message: 'Unknown Error.',
errors: [ {} ],
status: 'UNKNOWN'
}
export async function uploadFileToGoogleDrive(client: drive_v3.Drive, file: File, folderId?: string) {
const upload = async () => {
const response = await client.files.create({
requestBody: {
name: file.name,
mimeType: file.type,
...(folderId ? { parents: [folderId] } : {})
},
media: {
mimeType: file.type,
body: Readable.from(file.stream()),
},
fields: 'id,name,mimeType,webViewLink,thumbnailLink',
});
console.log(response);
return response;
};
try {
// const response = await retry(upload, {
// retries: 2,
// factor: 2,
// minTimeout: 1000,
// maxTimeout: 60000,
// randomize: true,
// onFailedAttempt: error => {
// console.error(`Attempt ${error.attemptNumber} failed. There are ${error.retriesLeft} retries left.`);
// }
// });
const response = await upload()
console.log('file uploaded', response)
return response;
} catch (err) {
console.error('Error uploading file to Google Drive: ', err.stack);
if (err.response && err.response.data && err.response.data.error) {
console.error('Google Drive API Error:', err.response.data.error);
}
logger.error('Error uploading file to Google Drive', err);
throw err;
}
}
- Dominant language
- TypeScript
- Stars
- 12.3k
- Forks
- 2k
- Avg merge
- 3d 10h
- Merged PRs (30d)
- 9
Getting set up
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from googleapis/google-api-nodejs-client
-
Difficulty 1/5 Under an hour Newbie friendliness 86/100
googleapis/google-api-nodejs-client#4064 ·
Maintainers usually reply within 2 days
-
Difficulty 4/5 1-2 days Newbie friendliness 5/100
googleapis/google-api-nodejs-client#4067 ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 1/100
googleapis/google-api-nodejs-client#4063 ·
Maintainers usually reply within 2 days
-
eMudhra/emSign CA compromise (October 2026): what Cloud SDK Node.js Libraries developers need to doOpen
Difficulty 1/5 Under an hour Newbie friendliness 10/100
googleapis/google-api-nodejs-client#4062 ·
Maintainers usually reply within 2 days
-
Difficulty 5/5 Over a week Newbie friendliness 10/100
googleapis/google-api-nodejs-client#4061 ·
Maintainers usually reply within 2 days
All issues in googleapis/google-api-nodejs-client
Similar issues
-
bug UI
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
wardian-app/Wardian#1746 ·
Maintainers usually reply within 1 day
-
area: interop area: sip-core v3
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
fonoster/routr#705 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
clawsweeper:fix-shape-clear clawsweeper:queueable-fix clawsweeper:source-repro impact:ux-friction issue-rating: 🦞 diamond lobster no-stale P2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
openclaw/openclaw#198551 · 1 comment · 1 reaction ·
Maintainers usually reply within 1 day