serverless-esbuild icon indicating copy to clipboard operation
serverless-esbuild copied to clipboard

Endless "Packaging" with @auth0/s3

Open mzl-md opened this issue 1 year ago • 2 comments

Describe the bug When using Serverless V4, serverless-esbuild and serverless-s3-sync, the sls package command gets stuck in the step Packaging. I tracked it down to being caused by s3-sync using https://github.com/auth0/node-s3-client. If you include require('@auth0/s3'); in the index.ts of serverless-esbuild, the open event on the writeStream here will not be called and the promise never returns. Moving serverless-s3-sync to the top of the plugins in serverless.yml seems to solve the problem in some cases, at least when serverless-domain-manager is between serverless-s3-sync and serverless-esbuild.

Steps to Reproduce

  • Open a project with serverless v4 and serverless-esbuild
  • Install @auth0/s3: npm i @auth0/s3
  • Add require('@auth0/s3'); to node_modules/serverless-esbuild/dist/index.js
  • Run Serverless: npx sls package --verbose

Screenshots

Screenshot 2024-11-25 at 12 28 33

Versions (please complete the following information):

  • OS: Mac
  • Serverless Framework Version: 4.4.11
  • Plugin Version: 1.54.6

mzl-md avatar Nov 25 '24 11:11 mzl-md

We also experienced a similar or the same issue with Serverless v3 (to be more precise: the fork from oss-serverless/serverless) and nodejs22.x.

Thanks to your description, I moved the S3 sync plugin to the top and that solved it for now.

❌ Not working:

plugins:
  - serverless-esbuild
  - serverless-iam-roles-per-function
  - serverless-plugin-aws-alerts
  - serverless-s3-sync

✅ Working:

plugins:
  - serverless-s3-sync
  - serverless-esbuild
  - serverless-iam-roles-per-function
  - serverless-plugin-aws-alerts

jonasduever avatar Feb 12 '25 14:02 jonasduever

In the end we removed serverless-s3-sync and replaced it with a AWS CLI call in our build script:

aws s3 sync build/frontend s3://my-bucket-name --delete

mzl-md avatar Feb 13 '25 07:02 mzl-md