k1LoW / serverless-s3-sync

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

Cannot read property 'defaultEncoding' #88

Open mbilalg opened 3 years ago

mbilalg commented 3 years ago

I had installed the plugin by following command in serverless 2.53.1.

npm install --save-dev serverless-s3-sync

After installing I had imported the plugin like this in serverless.yml

plugins:

But (serverless deploy) is giving the following error. Screenshot of error is also attached. (This error only happens when I import this plugin of serverless-s3-sync in serverless.yml file). eror

ERROR DETAILS: TypeError: Cannot read property 'defaultEncoding' of undefined at _write (node:internal/streams/writable:291:24) at WriteStream.Writable.write (node:internal/streams/writable:334:10) at NodejsStreamOutputAdapter.ondata (C:\serverless_v2\node_modules\readable-stream\lib_stream_readable.js:619:20) at NodejsStreamOutputAdapter.emit (node:events:394:28)

felipeespitalher commented 2 years ago

I'm facing same problem ... could you fix it ?

mklenbw commented 2 years ago

It's probably realted to the version of graceful-fs. The dependency @auth0/s3@1.0.0 of this plugin uses an old version (4.1.5) and the other plugins use graceful-fs@^4.2.0. This mismatch could lead to the problem.

sgerlach commented 1 year ago

Anyone else that runs into this, seems to be a conflict between

To fix it, I tweaked package.json to pin the underlying dependency to 4.2.8 and make this work.

... "resolutions": { "graceful-fs": "4.2.8" }, "scripts": { "test": "none", "preinstall": "npx npm-force-resolutions" }, ...