s3-deploy-website icon indicating copy to clipboard operation
s3-deploy-website copied to clipboard

How to use in continues integration, and successfully call multiple times

Open dkarchmer opened this issue 6 years ago • 1 comments

Sorry, I know this is more of an AWS question, but maybe you have seen this. As I am having trouble figuring it out.

I am basically setting up a continues deployment pipeline, and I am using your tool to deploy to s3/cloudfront. I deployed once successfully but now I am getting this error

botocore.errorfactory.InvalidArgument: An error occurred (InvalidArgument) when calling the CreateInvalidation operation: Your request contains a caller reference that was used for a previous invalidation batch for the same distribution.

My guess is that this is due to

response = cloudfront.create_invalidation(
                DistributionId=dist_id,
                InvalidationBatch=dict(
                    Paths=dict(
                        Quantity=len(paths),
                        Items=paths
                    ),
                    CallerReference='s3-deploy-website'
                )
            )

and the fact that uses the same string as CallerReference.

Should this use instead some string that changes from call to call (maybe adding a datetime.now())?

dkarchmer avatar Feb 10 '19 21:02 dkarchmer

Thanks, it seems that you are correct. The documentation indicates that this should be a unique string so something like appending the timestamp should work. Would you be able to open a PR?

jonls avatar Feb 12 '19 07:02 jonls