drone-s3-sync icon indicating copy to clipboard operation
drone-s3-sync copied to clipboard

Problem with Syncing S3 with invalidation of Cloudfront distribution when key has white space on beggining.

Open TKr opened this issue 5 years ago • 0 comments

Sync to S3: Done without problems (all files was changed) Invalidation CloudFront: Error 403 - authorization problem.

AWS user (Key+Secret) has all neeeded permissions.

ERROR: failed to invalidateCloudFront to /*: IncompleteSignature: 'AKIAT7AGGEXXXXXXXXXX/20191010/us-east-1/cloudfront/aws4_request' not a valid key=value pair (missing equal-sign) in Authorization header: 'AWS4-HMAC-SHA256 Credential=********/20191010/us-east-1/cloudfront/aws4_request, SignedHeaders=content-length;host;x-amz-date, Signature=c35c46c9d2f6c5aaa0b7357ec0406c823e7cbc1181624e4f3817************'. status code: 403, request id: 66a36506-eb61-11e9-973d-************

After removing white space from credencials Invalidations started to working. It was hard to find where is the problem becouse credensials are stored in as secrets, but when i opened database and quered for secrets related to repository i find a bug that i have done during copy + paste.

I think that different behavior when authorizing to S3 and to Cloudfront can be fixed using simple Trim().

TKr avatar Oct 17 '19 09:10 TKr