TTLabs / EvaporateJS

Javascript library for browser to S3 multipart resumable uploads

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Always get 403 SignatureDoesNotMatch error after resuming

mehranrezaei opened this issue · comments

I use this library in full compliance with official documentation and examples.
My server side program works properly for signing v4, and the upload is done properly.
But I have a problem with the pause and resume functions.
When I pause an upload, after resuming it, the first PUT request always gets a 403 (SignatureDoesNotMatch) error.
After a bit more research, it seems that the reason is that the library sends the wrong stringToSign to the server for signing on the first attempt after the resume.

This is last str_to_sign before pausing

AWS4-HMAC-SHA256 
_20220608T114339Z_ 
20220608/default/s3/aws4_request 
**b45c4ca1a7c7744ea2f3b6507bd3452317773cf30b860f4d98de662b8f7a85b6**

This is the first str_to_sign after resuming

AWS4-HMAC-SHA256
_20220608T114345Z_
20220608/default/s3/aws4_request
**b45c4ca1a7c7744ea2f3b6507bd3452317773cf30b860f4d98de662b8f7a85b6**

As you can see above the time has been changed but the canonicalRequest values are the same.

The line 1815 of evaporate.js should be deleted.
if (typeof this._cr !== 'undefined') { return this._cr; }

@armanforghani Thanks a lot. By removing that line my problem has been resolved.

You can create a PR to fix this issue.