Hey everyone, I’m having trouble with my Rust program that uploads big files to Google Drive. I’m using a service account to put 100GB files in a shared folder on my personal Drive. I’ve got a 10TB Google One plan, but the uploads keep failing.
The weird thing is, it works fine with regular login, but not with the service account. The error says ‘user storage quota exceeded’ after hours of uploading. When I check the API, it shows a 16GB limit, which makes no sense given my plan.
I’ve tried a few things:
- Using
.supports_all_drives(true)
- Checking GCP quotas (nothing storage-related shows up)
- Looking into domain-wide delegation (doesn’t work for personal accounts)
My code looks something like this:
let auth = oauth2::ServiceAccountAuthenticator::builder(key)
.persist_tokens_to_disk(cache_path)
.build()
.await;
let hub = DriveHub::new(client, auth);
hub.files().create(file_info)
.supports_all_drives(true)
.upload_resumable(big_file, mime_type)
.await;
Any ideas on how to bypass this 16GB limit with a service account? I want to use all the space I paid for!
I’ve encountered a similar issue when working with service accounts and Google Drive. The 16GB limit you’re experiencing is likely due to the default quota assigned to service accounts, which is separate from your personal Google One plan.
To resolve this, you might need to contact Google Cloud Support and request an increase in the storage quota for your service account. They can typically adjust this to match your Google One plan capacity.
Another workaround you could try is using a refresh token flow instead of a service account. This method allows you to authenticate as your personal account programmatically, which should give you access to your full storage quota.
If you absolutely need to use a service account, consider breaking your large files into smaller chunks and uploading them separately. You can then use the Drive API to reassemble them on the Drive side.
Remember to always implement proper error handling and retry mechanisms for large file uploads, as network interruptions can occur during long transfers.
hey mate, i had a similar headache. try this: use your personal account’s refresh token instead of service account. it’s a bit trickier to set up, but you’ll get full access to your 10TB. Also, make sure you’re not hitting any API rate limits. good luck!
I’ve encountered this frustrating limitation before. The 16GB cap for service accounts is something that affects many users who expect their personal Google One plan limits to apply. In my experience, the workaround was to switch over to using OAuth 2.0 credentials rather than a service account. This means setting up OAuth credentials in the Google Cloud Console and implementing the authorization flow in Rust to obtain an access token. Once you do this, you’ll bypass the service account restrictions and gain access to your full storage quota. Remember to manage token refreshing to ensure smooth uploads over long periods.