An exception “The Content-MD5 you specified did not match what we received”

后端 未结 5 1579
谎友^
谎友^ 2021-01-17 17:14

I got an exception, I never got before when testing my application that uploads a file from ec2 to s3. The content is:

Exception in thread \"Thread-1\" com.a         


        
5条回答
  •  旧巷少年郎
    2021-01-17 17:57

    I too ran into this problem. How I solved this:

    I have a microservice that processes AWS SQS Messages. Each message would create multiple temporary files that would have to be uploaded to S3.

    The issue was that the temporary files were named with fixed names without any salt added to them.

    So between two messages, it was possible to rewrite the original file that was to be uploaded.

    I fixed it by adding a random salt (this can be a UUID or the current time in millis depending on what you want) to the file names, after which the files were not being over-written and were successfully uploaded to S3.

提交回复
热议问题