I’ve been using serverless-s3-deploy for months to deploy 3 sites. Today I tried to deploy for the first time in a month or so, and and it told me my bucket already exists. Well duh. (Continued below the log file.)
john-xps-15-7700hq:~/projects/ExtendedStatsServerless/client (master) $ sls deploy
Serverless: Packaging service...
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
.....
Serverless: Stack create finished...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
...
Serverless: Operation failed!
Serverless Error ---------------------------------------
An error occurred: StaticBucket - test.drfriendless.com already exists.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information -----------------------------
OS: linux
Node Version: 8.12.0
Serverless Version: 1.33.1
So I figure it’s AWS trying to tell me some other thing, so I deleted the deployment stack and bucket (not test.drfriendless.com) and tell it to do it again. But it gives the same error. OK, test.drfriendless.com is not that vital, so I delete it as well although I don’t believe it’s the problem. (More below.)
john-xps-15-7700hq:~/projects/ExtendedStatsServerless/client (master) $ sls deploy
Serverless: Packaging service...
Serverless: Creating Stack...
Serverless: Checking Stack create progress...
.....
Serverless: Stack create finished...
Serverless: Uploading CloudFormation file to S3...
Serverless: Uploading artifacts...
Serverless: Validating template...
Serverless: Updating Stack...
Serverless: Checking Stack update progress...
......
Serverless: Stack update finished...
Service Information
service: client
stage: dev
region: ap-southeast-2
stack: client-dev
api keys:
None
endpoints:
None
functions:
None
So it pretends to do the job, and recreates test.drfriendless.com, but the bucket is empty. Here’s my serverless.yml: (Continued below.)
service: client
plugins:
- serverless-s3-deploy
provider:
name: aws
runtime: nodejs6.10
stage: ${opt:stage, 'dev'}
timeout: 30
region: ap-southeast-2
custom:
assets:
targets:
- bucket:
Ref: StaticBucket
files:
- source: static/
globs: '**/*.*'
resources:
Resources:
StaticBucket:
Type: AWS::S3::Bucket
Properties:
BucketName: ${file(../stage.${self:provider.stage}.json):CLIENT_BUCKET}
AccessControl: PublicRead
WebsiteConfiguration:
IndexDocument: index.html
ErrorDocument: index.html
As you can see I’m doing nothing complex, just copying the contents of static up to the site. And of course static has loads of stuff in it.
I find this process to generally be absurdly flaky, and I suspect it’s AWS’s fault. What other things can I try to get my site back? Thank you.