Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bucketPrefix uploads one file too much (not in localDir) #86

Closed
patrickbussmann opened this issue Jun 9, 2021 · 0 comments · Fixed by #94
Closed

bucketPrefix uploads one file too much (not in localDir) #86

patrickbussmann opened this issue Jun 9, 2021 · 0 comments · Fixed by #94

Comments

@patrickbussmann
Copy link
Contributor

Very small serverless.yml:

service: example

provider:
    name: aws
    stage: ${opt:stage, 'dev'}
    region: eu-central-1
    runtime: provided.al2

custom:
    s3Sync:
        -   bucketNameKey: UpdateBucketName
            bucketPrefix: app/
            localDir: update
            params:
                -   "*.json":
                        CacheControl: 'no-cache'

plugins:
    - serverless-s3-sync

resources:
    Resources:
        UpdateBucket:
            Type: AWS::S3::Bucket
            Properties:
                AccessControl: PublicRead
        UpdateBucketPolicy:
            Type: AWS::S3::BucketPolicy
            Properties:
                Bucket: !Ref UpdateBucket
                PolicyDocument:
                    Statement:
                        -   Effect: Allow
                            Principal: '*'
                            Action: 's3:GetObject'
                            Resource: !Join [ '/', [ !GetAtt UpdateBucket.Arn, '*' ] ]

    Outputs:
        UpdateBucketName:
            Value: !Ref UpdateBucket

Deployment works successful.

S3 Sync: Syncing directories and S3 prefixes...
...........
S3 Sync: Synced.
S3 Sync: Syncing metadata...
.
S3 Sync: Synced metadata.
S3 Sync: Updating bucket tags...
.
S3 Sync: Updated bucket tags.
Serverless: Removing old service artifacts from S3...

And then I have one file too much in my bucket.

manifest.json
app/manifest.json
app/update.zip.001
app/update.zip.002
app/update.zip.003
app/update.zip.004
app/update.zip.005

Everything fine except the manifest.json which is in root directory.
But I used the bucketPrefix so that this shouldn't happen.

The timestamp is like the others. When I remove the file manually and run sls deploy again the file is again there.

Maybe there is an logical issue with the bucketPrefix?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant