Endless "Packaging" with @auth0/s3
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
Versions (please complete the following information):
- OS: Mac
- Serverless Framework Version: 4.4.11
- Plugin Version: 1.54.6
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
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