robmarkcole / HASS-S3

Home Assistant integration for S3
Apache License 2.0
24 stars 15 forks source link

BadDigest error when uploading some files #32

Closed george-crum closed 1 year ago

george-crum commented 1 year ago

I posted this question too soon. Eventually the directories showed up in the s3 bucket. So this configuration does work.

      key: "test{{ trigger.event.data.path }}"
      file_path: "{{ trigger.event.data.path }}"

However now I believe this error I'm seeing is because the file is still being written to, which would explain the md5 mis-match.

boto3.exceptions.S3UploadFailedError: Failed to upload /media/recordings/2023-06-26/20/1_front_door/12.07.mp4 to <bucketname>/test/media/recordings/2023-06-26/20/1_front_door/12.07.mp4: An error occurred (BadDigest) when calling the PutObject operation (reached max retries: 4): The Content-MD5 you specified did not match what we received.

Is this because folder_watcher doesn't recognize when a file is still open?

Thank you.

george-crum commented 1 year ago

After reading folder_watcher docs more attentively I fixed the baddigest error by changing event_type to closed. Sorry for the noise here.