drive_v3 files.create unable to get resumable session URI
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- nodejs, typescript
- Domain
- api
Research direction
Start with the drive_v3 files.create definition in src/apis/drive/v3.ts and then inspect createAPIRequestAsync in the linked nodejs-googleapis-common src/apirequest.ts. Compare the request construction with the Drive resumable-upload documentation; done means files.create can obtain the resumable session URI through the specified uploadType without requiring a manual POST or rootUrl override.
Written by the indexing model from the issue text.
Description
Feature
I think that would be nice to be able to get the resumable session URI by specifying the uploadType: 'resumable' parameters on the drive_v3 files.create method, instead of doing a POST request.
const params = {
uploadType: 'resumable'
};
const options = {};
const res = await drive.files.create(params, options);
const uri = res.headers.location;
Motivation
Initially I thought that was the case by reading the documentation on how to perform a resumable upload (link).
So I take a look at the code to understand how to do that but unfortunately it seems impossible.
To summarise the documentation to get a resumable URI we need to do a POST like so:
POST https://www.googleapis.com/upload/drive/v3/files?uploadType=resumable
If we take a look at how the create method it's implemented we found out that we have this URI in to the mediaUrl attribute. (link)
If we take a look how the request it's constructed we found out that only when we have the media.body the correct url it's used. But then the uploadType it's changed in to something else. So the POST request can't be constructed as desired. (link)
Solution
In this case a first simple fix would be modify the createAPIRequestAsync of googleapis-common to add another if statement to enforce the right URI when we have an empty body and the uploadType is set to "resumable". Pretty much like so:
if (parameters.mediaUrl && media.body) {
options.url = parameters.mediaUrl;
if (resource) {
params.uploadType = 'multipart';
// more code
} else {
params.uploadType = 'media';
// more code
}
} else if (parameters.mediaUrl && params.uploadType === 'resumable') {
options.url = parameters.mediaUrl;
} else {
options.data = resource || undefined;
}
The current solution that I could find instead is to override the URI in the options like so:
const options = {
rootUrl: 'https://www.googleapis.com/upload'
};
Please let me know if i'm missing something or if I should proceed with a pull request on nodejs-googleapis-common repository.
- 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