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

deleteRemoved: false is not working always #92

Open
a-marcel opened this issue Oct 7, 2021 · 1 comment
Open

deleteRemoved: false is not working always #92

a-marcel opened this issue Oct 7, 2021 · 1 comment

Comments

@a-marcel
Copy link

a-marcel commented Oct 7, 2021

Hello,

i figured out that there is an issue, if one directory has the option deletedRemoved: true and all other are using deletedRemoved: false.

s3Sync:
    - bucketName: belayus-${self:service}-${opt:stage, self:provider.stage}
      bucketPrefix: ${opt:stage, self:provider.stage}/_next/static-pages
      localDir: .serverless_nextjs/assets/static-pages/
      acl: private
      deleteRemoved: false
      
    - bucketName: belayus-${self:service}-${opt:stage, self:provider.stage}
      bucketPrefix: ${opt:stage, self:provider.stage}/_next/static/
      localDir: .serverless_nextjs/assets/_next/static
      acl: private
      deleteRemoved: false

    - bucketName: belayus-${self:service}-${opt:stage, self:provider.stage}
      bucketPrefix: ${opt:stage, self:provider.stage}/_next/data/
      localDir: .serverless_nextjs/assets/_next/data
      acl: private
      deleteRemoved: false

    - bucketName: belayus-${self:service}-${opt:stage, self:provider.stage}
      bucketPrefix: ${opt:stage, self:provider.stage}
      localDir: env-public-files/${opt:stage, self:provider.stage}/
      acl: private
      deleteRemoved: true

some files of the other configurations will be deleted even if they are configured with deleteRemoved: false.

After i set the last one to false. it works like expected.

I was trying to dig deeper but didn't found the exact issue in your code.

Thanks for checking.

@coyoteecd
Copy link
Contributor

@a-marcel your issue is that the bucket prefix of the last entry includes the bucket entries synced by the previous 3 entries. The deleteRemoved flag is passed as-is to the S3 client, and it does what it's supposed to do (i.e. delete all files that start with bucketPrefix, that are not in the local dir).

The fact that all the uploading is done in parallel explains why the issue occurs for "some" of the files.

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

No branches or pull requests

2 participants