sdaoudi / HomeAssistant-GDrive-Uploader

Goole Drive Uploader component for Home Assistant
3 stars 0 forks source link

Receiving 404 not found #14

Open yevon opened 1 week ago

yevon commented 1 week ago

Hi! I followed the guide to integrate this, but I'm receiving this error if I look at the trace of my automation. What should I check? If I put a wrong path for the upload_file_path, it says in HA logs that the file doesn't exist, so the error is server side from gdrive api, that is unable to find something. The folder ID is the one that appears at the google drive url isnt' it? When creating service account credentials in gcloud, I selected "Editor" Role, and didn't select share with anyone in the third step. Maybe I'm missing something.

Error: <HttpError 404 when requesting https://www.googleapis.com/drive/v2/files?q=%277WgBVE_<REST_OF_THE_TOKEN>%27+in+parents+and+trashed%3Dfalse&maxResults=1000&supportsAllDrives=true&includeItemsFromAllDrives=true&alt=json returned "File not found:". Details: "[{'message': 'File not found: ', 'domain': 'global', 'reason': 'notFound', 'location': 'file', 'locationType': 'other'}]">

In the upload_file_path if I place a prefix / in the path, it is unable to find the file.

action: gdrive_uploader.upload
metadata: {}
data:
  parent_id: <MY_FOLDER_ID>
  upload_file_path: www/MY_FILE.jpg
sdaoudi commented 3 days ago

Hello,

The issue is not with the upload_file_path. If the file specified by upload_file_path did not exist, you would encounter the error:
[custom_components.gdrive_uploader] The file with path www/MY_FILE.jpg is not found.

In your case, the file does exist, and the integration is able to load it successfully. The problem lies with the parent_id. You may have either copied the folder ID incorrectly or are attempting to upload the document to a directory to which you do not have access.

Which authentication method are you using? Are you utilizing a service account or an access token?

Permission issues frequently arise when using service account authentication. I recommend switching to an access token instead. Please refer to the following documentation for generating an access token:

Access Token Documentation