I can’t find out how to fix that error. What I know is that my file is saved to Active_storage with a digest. Amazon s3 that the digest are not equal = bad digest.
I hope someone can help me fix it. Regards, Poul Erik Rasmussen
I can’t find out how to fix that error. What I know is that my file is saved to Active_storage with a digest. Amazon s3 that the digest are not equal = bad digest.
I hope someone can help me fix it. Regards, Poul Erik Rasmussen
When you upload using the ActiveStorage JS the MD5 gets computed using the Spark-MD5 library. What you need to check is:
Maybe I’d start by comparing the checksum at each step rather than looking at the final ActiveStorage record first. S3 checks Content-MD5 against the actual bytes it receives, so I’d compare the checksum ActiveStorage creates with the Content-MD5 header on the PUT request. Also make sure you’re comparing the same representation - S3 expects the MD5 in Base64, not the usual hex string. The CORS config mentioned above is worth ruling out too, especially whether Content-MD5 is allowed. Although if S3 is already returning BadDigest, I’d suspect a checksum mismatch before CORS.
I’d probably calculate the MD5 independently for the same file and compare that with what’s being sent in DevTools. That should narrow it down pretty quickly to either checksum generation or the actual upload request.