ERR_INVALID_ARG_TYPE (undefined) after upgrade to Webpack 5
See original GitHub issuePlease complete these steps and check these boxes (by putting an x inside
the brackets) before filing your issue:
- I have read and understood this plugin’s README
- If filing a bug report, I have included my version of node and s3-plugin-webpack
- If filing a bug report, I have included which OS (including specific OS version) I am using.
- If filing a bug report, I have included a minimal test case that reproduces my issue.
- I understand this is an open-source project staffed by someone with a job and that any help I receive is done on free time. I know I am not entitled to anything and will be polite and courteous.
- I understand my issue may be closed if it becomes obvious I didn’t actually perform all of these steps or the issue is not with the library itself
Thank you for adhering to this process! This ensures that I can pay attention to issues that are relevant and answer questions faster.
Issue Details
If filing a bug report, please include a list of steps that describe how to
reproduce the bug you are experiencing. Include your config being passed to the S3Plugin.
Operating system: macOS Catalina 10.15.5
Node version: 10.16.0
s3-plugin-webpack: 1.0.3
webpack: 5.0.0-beta.20
S3Plugin config:
new S3Plugin({
exclude: /.*\.html$/,
include: /.*\.(css|js|gif|svg|eot|woff2|woff|ttf)/,
s3Options: {
accessKeyId: process.env.AWS_ACCESS_KEY_ID,
secretAccessKey: process.env.AWS_SECRET_ACCESS_KEY,
region: 'us-east-1',
},
s3UploadOptions: {
Bucket: process.env.S3_ASSETS_BUCKET,
},
}),
Steps to reproduce
- Upgrade Webpack from
4.43.0to5.0.0-beta.20 - Run
webpack --config webpack.prod.js(in this case)
I receive the following error:
98% after emitting webpack-s3-plugin
***** UPLOAD FILE ***** 687a4990ea22bb1a49d469a5d9319790.woff2 undefined
98% after emittingTypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be one of type string, Buffer, or URL. Received type undefined
at Object.open (fs.js:408:3)
at ReadStream.open (internal/fs/streams.js:110:12)
at new ReadStream (internal/fs/streams.js:99:10)
at Object.createReadStream (fs.js:1732:10)
at t.exports.uploadFile (.../node_modules/webpack-s3-plugin/dist/s3_plugin.js:134:131)
at t.map.t (.../node_modules/webpack-s3-plugin/dist/s3_plugin.js:123:103)
at Array.map (<anonymous>)
at transformBasePath.then (.../node_modules/webpack-s3-plugin/dist/s3_plugin.js:123:89)
at process._tickCallback (internal/process/next_tick.js:68:7)
While debugging, I added the ***** UPLOAD FILE *****
console.logto this method: https://github.com/MikaAK/s3-plugin-webpack/blob/master/src/s3_plugin.js#L288
When on webpack 4.43.0, the second parameter returns the full file path, and not undefined as it does now.
To the best of my knowledge, we’re following documentation as specified. I’ve looked through any issues that might be related, and none seem to be directly related.
Note: the app is not using create-react-app.
Any help is appreciated.
Best, Sam
Issue Analytics
- State:
- Created 3 years ago
- Comments:13 (8 by maintainers)

Top Related StackOverflow Question
@MikaAK np, ill look into potentially doing a PR for this
Hey @samageloff this is indeed the case!! We’ll need to make the fix for Webpack 5, I’ll have some free time probably next weekend, but in the meantime PR’s would be much welcome!