Bundling fails in github actions
Hi everyone.
This might not be an issue with the package itself but I thought that this should be posted somewhere as others might run into this issue.
When deploying with the serverless framework, during the bundling phase of the process I'm getting this error in github actions 'npm run script0 failed with code 1'
As a next step I setup the 'SLS_DEBUG=*' to see what might be going on in the process. These are the logs generated right before the process fails;
Serverless: Removing /github/workspace/.webpack
Serverless: Individually packaging with concurrency at 6 entries a time.
Serverless: Bundling with Webpack...
Serverless: Fetch dependency graph from /github/workspace/package.json
Serverless: Ignoring 2 NPM errors:
Serverless: => peer dep missing: serverless@1, required by [email protected]
Serverless: => peer dep missing: webpack@^3.0.0 || ^4.0.0-alpha.0 || ^4.0.0, required by [email protected]
Serverless: Adding explicit peers for dependency @prisma/client
Serverless: Skipping peers dependency prisma for dependency @prisma/client because it's optional
Serverless: Adding explicit peers for dependency pdfjs-dist
Serverless: WARNING: Could not determine version of module webpack
Serverless: Adding explicit peers for dependency pdfjs-dist
Serverless: WARNING: Could not determine version of module webpack
Serverless: Adding explicit peers for dependency pdfjs-dist
Serverless: WARNING: Could not determine version of module webpack
Serverless: Adding explicit peers for dependency pdfjs-dist
Serverless: WARNING: Could not determine version of module webpack
Serverless: WARNING: Could not determine version of module dotenv
Serverless: Excluding external modules: aws-sdk@^2.835.0
Serverless: Package lock found - Using locked versions
Serverless: Packing external modules: argon2@^0.27.0, jsonwebtoken@^8.5.1, validator@^13.5.2, @prisma/[email protected], nodemailer@^6.4.16, randomstring@^1.1.5, axios@^0.21.0, qs@^6.9.4, lodash@^4.17.20, @***/***search@^7.10.0, uuid@^8.3.2, pdf-lib@^1.16.0, jspdf@^2.3.0, currency-symbol-map@^5.0.1, pdfjs-dist@^2.0.943, webpack, excel4node@^1.7.2, oauth-1.0a@^2.2.6, dotenv
Serverless: Package took [34347 ms]
Serverless: Copy modules: /github/workspace/.webpack/login [3901 ms]
Serverless: Prune: /github/workspace/.webpack/login [2810 ms]
Error ---------------------------------------------------
Error: npm run script0 failed with code 1
at ChildProcess.<anonymous> (/github/workspace/node_modules/serverless-bundle/node_modules/serverless-webpack/lib/utils.js:91:16)
at ChildProcess.emit (events.js:400:28)
at ChildProcess.emit (domain.js:475:12)
at maybeClose (internal/child_process.js:1058:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)
For debugging logs, run again after setting the "SLS_DEBUG=*" environment variable.
Get Support --------------------------------------------
Docs: docs.serverless.com
Bugs: github.com/serverless/serverless/issues
Issues: forum.serverless.com
Your Environment Information ---------------------------
Operating System: linux
Node Version: 14.18.1
Framework Version: 2.66.1 (local)
Plugin Version: 5.5.1
SDK Version: 4.3.0
Components Version: 3.18.0
One thing to note is that the process does work locally, but does not work on github actions. Anyone else faced this issue?
I understand that opening an issue might not be the best avenue for tackling this, so feel free to suggest other ways of tackling the problem.
This might be related with serverless-webpack plugin since the logs
Serverless: Copy modules: /github/workspace/.webpack/login [3901 ms]
Serverless: Prune: /github/workspace/.webpack/login [2810 ms]
are coming from the serverless-webpack package from this file
Seems like if there are scripts that need to be run in the packagerOptions section then that is making the deployment process fail in github actions.
packagerOptions:
scripts:
- rm -rf node_modules/.prisma/client/query-engine-debian-openssl-1.1.x
In my case when I commented out the code above in our serverless.yml file the deployment process did not output an error. I'll try to see why this might be the case. I'm assuming it probably has to do with some sort of permissions.