-
Notifications
You must be signed in to change notification settings - Fork 415
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
TypeError: fs.readFileAsync is not a function #1912
Comments
There's also a SO question about this issue: https://stackoverflow.com/questions/78888120/serverless-webpack-giving-error-while-deploying-on-lambda |
Well the package is working well when using Serverless < 4. Maybe that's a problem related with Serverless. What version of node are you using btw? |
My node is v18.18.2 |
Yeah, maybe serverless < 4 did promisifyAll(fs) and serverless-webpack relied on that assumption..? If so, now serverless-webpack should promisify fs by itself. |
+1 thanks for #1917 patch is working, lets get this merged in
|
This is a Bug Report
Description
When I run
serverless package
, I get errorfs.readFileAsync is not a function
and build fails:The error seems to come from this code block inside serverless-webpack:
As far as I could figure this out, the
fs.readFileAsync
is not part of Node's fs module but that kind of (*Async
) functions are created by "promisifying" a callback-based function. However, such promisifying is not done inside this package.If I add
BbPromise.promisifyAll(fs);
below the imports in filepackageModules.js
, the build process succeeds.I don't understand how this package works for other people if such promisifying step is missing.
Additional Data
The text was updated successfully, but these errors were encountered: