Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

<HttpError 404 when requesting https://www.googleapis.com/drive/v2/files/1CwhDy8SBXaInfY2WdWfgK1wROeUNuesC?alt=json returned "File not found: 1CwhDy8SBXaInfY2WdWfgK1wROeUNuesC"> #1186

Closed
bc060400164 opened this issue Feb 17, 2021 · 6 comments
Assignees
Labels
api: drive Issues related to the Drive API API. needs more info This issue needs more information from the customer to proceed. type: question Request for information or clarification. Not an issue.

Comments

@bc060400164
Copy link

After some days i start getting the error. To solve the issue i need the other Gmail account. Why its happening? Any comment or guideline. File is there in drive with same link. After one week it starts giving the error.

@parthea
Copy link
Contributor

parthea commented Feb 17, 2021

Hi @bc060400164 ,

Please can you share some sample code to see if this issue can be reproduced? As we haven't released a new version of this client library recently, my initial thought is that you may need to file a bug directly with the upstream API using these steps.

@parthea parthea added api: drive Issues related to the Drive API API. type: question Request for information or clarification. Not an issue. needs more info This issue needs more information from the customer to proceed. labels Feb 17, 2021
@bc060400164
Copy link
Author

Dear parthea
This is the sample code and the error is uploaded, if I use the new google account it will work for one week approx and after that error will reproduce. i tried on two to three google accounts.:

error

file_id = '1CwhDy8SBXaInfY2WdWfgK1wROeUNuesC'
downloaded = drive.CreateFile({'id': file_id})
downloaded = drive.CreateFile({'id':'1CwhDy8SBXaInfY2WdWfgK1wROeUNuesC'}) # replace the id with id of file you want to access
downloaded.GetContentFile('cherat-final-dataset.csv')

Read file as panda dataframe

import pandas as pd

@parthea parthea self-assigned this Mar 3, 2021
@Squirrel623
Copy link

Squirrel623 commented Apr 20, 2021

I'm having a similar issue and I suspect it is an issue on Google's side but I haven't figured out anything yet.

I have a Google Cloud Platform service account with domain-wide delegation enabled and https://www.googleapis.com/auth/drive scope.

Until recently the server using this account has not had any problems connecting to three different shared drives, creating folders underneath them, or returning a folder's contents.

Now, the server is getting 404s when trying to create folders underneath a drive or list a directory's contents under the drive. The drive and those folders definitely exist - I can access them on the Google Drive web page. That leads me to believe this is a permissions issue but I have not found anything on my search.

This is the code for creating a folder underneath a drive that now returns a 404 and tells me the drive does not exist:

file_metadata = {
    'name':  name,
    'mimeType': 'application/vnd.google-apps.folder',
    'parents': [drive_id]
}

file = service.files().create(body=file_metadata, fields='id', supportsAllDrives=True).execute()

I'm not sure exactly when this started happening but it was brought to my attention in the past few weeks. I don't think there is anything that this package can do to help out because it is just forwarding on Google's response but maybe someone can point us in the right direction.

Edit: I forgot to mention that this is only an issue for 2 of the 3 drives this server connects to. One still works properly.

And Google's documentation on this is not helpful: https://developers.google.com/drive/api/v3/handle-errors#resolve_a_404_error_file_not_found_fileid

I am using version 1.12.8 of this library and I have not updated it since I have been working for my employer.

I have posted this question to stackoverflow as well: https://stackoverflow.com/questions/67186894/shared-google-drive-suddenly-returning-404-with-service-account

@Squirrel623
Copy link

I ended up figuring out my issue: https://stackoverflow.com/a/67199941/5404586

@parthea
Copy link
Contributor

parthea commented Aug 9, 2021

I'm going to close this issue as obsolete but please feel free to re-open it if the issue still exists.

@parthea parthea closed this as completed Aug 9, 2021
@ManuelElizaldi
Copy link

ManuelElizaldi commented May 16, 2024

Hello! Was there any solution to this issue?

I am currently running into a problem where my service account has access to a shared drive, I can get a list of the contents, but when I try to copy a file inside said folder I get the following error:

HttpError: <HttpError 404 when requesting https://www.googleapis.com/drive/v3/files/1Gj3CrJJkIPu08RlXR2nsSfNpNshYdRzyu73GX-J50QM?alt=json returned "File not found: 1Gj3CrJJkIPu08RlXR2nsSfNpNshYdRzyu73GX-J50QM.". Details: "[{'message': 'File not found: 1Gj3CrJJkIPu08RlXR2nsSfNpNshYdRzyu73GX-J50QM.', 'domain': 'global', 'reason': 'notFound', 'location': 'fileId', 'locationType': 'parameter'}]">

I know the file exists since when I do :

response = service.files().list(q = query, fields = "files(id, name)", includeItemsFromAllDrives = True, supportsAllDrives = True).execute()
files = response.get('files', [])

I indeed get a list of files. Using the output from this I tried making a copy of a file to no avail:

# ID of the folder where you want the copy
folder_id = '1nUmm845UJF6vbMhUjq_r5CVvEjOUktAf'

# ID of the file you want to copy
original_id = '1Gj3CrJJkIPu08RlXR2nsSfNpNshYdRzyu73GX-J50QM'

# Name of the copy
copy_name = 'copy'

# New file metadata
new_file = {'name': copy_name, 'parents': [folder_id]}

# Copy the file
copied_file = service.files().copy(fileId=original_id, body=new_file).execute()

# Get the ID of the copied file
copied_file_id = copied_file['id']

any help will be greatly appreciated!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: drive Issues related to the Drive API API. needs more info This issue needs more information from the customer to proceed. type: question Request for information or clarification. Not an issue.
Projects
None yet
Development

No branches or pull requests

4 participants