k1LoW / serverless-s3-sync

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

TypeError: Cannot read property 'hasOwnProperty' of undefined at serverlessS3Sync.sync #90

Open DBankx opened 2 years ago

DBankx commented 2 years ago

Hi, i am trying to deploy my react app frontend application using serverless and the serverlessS3Sync plugin and upon running the command sls deploy -v, everything works fine up until the end and it throws the error

Type Error ---------------------------------------------- TypeError: Cannot read property 'hasOwnProperty' of undefined at ServerlessS3Sync.sync (/Users/dami/dev/capitack/capitack-main-frontend/node_modules/serverless-s3-sync/index.js:112:15) at ServerlessS3Sync.tryCatcher (/Users/dami/dev/capitack/capitack-main-frontend/node_modules/bluebird/js/release/util.js:16:23) at Promise._settlePromiseFromHandler (/Users/dami/dev/capitack/capitack-main-frontend/node_modules/bluebird/js/release/promise.js:547:31) at Promise._settlePromise (/Users/dami/dev/capitack/capitack-main-frontend/node_modules/bluebird/js/release/promise.js:604:18) at Promise._settlePromiseCtx (/Users/dami/dev/capitack/capitack-main-frontend/node_modules/bluebird/js/release/promise.js:641:10) at _drainQueueStep (/Users/dami/dev/capitack/capitack-main-frontend/node_modules/bluebird/js/release/async.js:97:12) at _drainQueue (/Users/dami/dev/capitack/capitack-main-frontend/node_modules/bluebird/js/release/async.js:86:9) at Async._drainQueues (/Users/dami/dev/capitack/capitack-main-frontend/node_modules/bluebird/js/release/async.js:102:5) at Immediate.Async.drainQueues [as _onImmediate] (/Users/dami/dev/capitack/capitack-main-frontend/node_modules/bluebird/js/release/async.js:15:14) at processImmediate (internal/timers.js:462:21)

I have checked the plugin files in the node_modules folder and the issue is origination from these lines: sync() { let s3Sync = this.serverless.service.custom.s3Sync; if(s3Sync.hasOwnProperty('buckets')) { s3Sync = s3Sync.buckets; } .......

Please is there any fix for this? please i need this ASAP as i am tasked with deploying the company's frontend on aws. Thanks and i await your responses!

sreerammeka commented 1 year ago

@DBankx I'm also facing a similar issue. Are you able to resolve this issue?

marc-axonista commented 1 year ago

@sreerammeka Be sure to have a s3Sync section under the custom section and note the capital "S" in s3Sync.