k1LoW / serverless-s3-sync

A plugin to sync local directories and S3 prefixes for Serverless Framework :zap:
182 stars 68 forks source link

Bug in parameters #36

Closed maxmode closed 4 years ago

maxmode commented 4 years ago

The bug was ignoring first entry in parameters configuration.

k1LoW commented 4 years ago

@maxmode Thank you !

k1LoW commented 4 years ago

Released as v1.9.2.

lsanders commented 4 years ago

Hey guys! This PR reverted some logic in #33 which fixed a problem with a config like this:

  s3Sync:
    - bucketName: ${self:custom.siteName}
      bucketPrefix: shell/
      localDir: build
      params:
        - '**':
          CacheControl: max-age=3600
        - 'index.html':
          CacheControl: 'max-age=0,no-cache,no-store,must-revalidate'
        - 'sw.js':
          CacheControl: 'max-age=0,no-cache,no-store,must-revalidate'

In that case, the first key is the glob and needs to be ignored. Is there a different format that was unaccounted for? Perhaps you can post your config, @maxmode?

lsanders commented 3 years ago

In case anyone stumbles on this issue the yaml syntax is off in my comment above. There should be indention on the properties after the param keys (doh!):

      params:
        - '**':
            CacheControl: max-age=3600
        - 'index.html':
            CacheControl: 'max-age=0,no-cache,no-store,must-revalidate'
        - 'sw.js':
            CacheControl: 'max-age=0,no-cache,no-store,must-revalidate'

The errors were:

  MultipleValidationErrors: There were 12 validation errors:
  * UnexpectedParameter: Unexpected key '0' found in params
  * UnexpectedParameter: Unexpected key '1' found in params
  * UnexpectedParameter: Unexpected key '2' found in params
  ...