Deploy Again

From @littleredshack on Wed Dec 13 2017 06:13:36 GMT+0000 (UTC)

Strange one. I have got all the way through the process and all working fine. But when I try to redeploy to S3 I get an error about my AWS key being invalid.

C:\Users\gstokes\Documents\Personal\Coding\Serverless\notes-app-frontend\notes-app-client>aws s3 sync build/ s3://gbs-notes-app-client
fatal error: An error occurred (InvalidAccessKeyId) when calling the ListObjects operation: The AWS Access Key Id you provided does not exist in our records.

I have re-run AWS configure just in case those got changed somehow. Still not working.

Anyone got any ideas?

From @littleredshack on Wed Dec 13 2017 06:53:52 GMT+0000 (UTC)

I just went into IAM and then in the user that I had originally created I chose the option to create a new Access Key. I used that and it is working. No idea why the previous one suddenly stopped.

From @drakeloud on Sat Feb 24 2018 04:30:09 GMT+0000 (UTC)

I’m not sure if anyone else has pointed this out in a different chapter, but I think that you should add the --delete flag when syncing your s3 bucket. So the full command would be this:

aws s3 sync build/ s3://YOUR_S3_DEPLOY_BUCKET_NAME --delete

This deletes the files that aren’t in your local directory. When you run npm build, it creates unique ids for the static files, so simply syncing s3 gives you the old files, and adds the new ones. E.g. my app is 6MB and it was adding another 6MB every time I deploy.

From @jayair on Sat Feb 24 2018 14:27:58 GMT+0000 (UTC)

@drakeloud Good point. I’ll add a note.

When I deploy with new update, I got the error message.

F:\GitProject\nodejs\serverless\notes-app-client>aws s3 sync build/ s3://notes-upload-1688 --delete
C:\Program Files\Amazon\AWSCLI\.\dateutil\parser.py:605: UnicodeWarning: Unicode equal comparison failed to convert both arguments to Unicode - interpreting them as being unequal

Any idea?

That’s pretty weird and seems related to the AWS CLI. Does your deploy fail or is this just a warning?

It is a warning. I can deploy the project.

Thanks,

1 Like

I see. Yeah I’m not sure what is causing it but it’s good that it deployed okay.

why do you need to invalidate everything with the wildcar option, and not just index.html & service-worker.js ?

Yeah you could I guess. But if you had other files it would make it harder to invalidate them one by one right?

Other files should be cached busted with hash embedded in the filename