question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ERR_INVALID_ARG_TYPE (undefined) after upgrade to Webpack 5

See original GitHub issue

Please 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

  1. Upgrade Webpack from 4.43.0 to 5.0.0-beta.20
  2. 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.log to 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:closed
  • Created 3 years ago
  • Comments:13 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
OllieJenningscommented, Nov 3, 2020

@MikaAK np, ill look into potentially doing a PR for this

1reaction
MikaAKcommented, Jul 16, 2020

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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

The "path" argument must be of type string ... - Stack Overflow
This happened for me after upgrading RedwoodJS via yarn rw upgrade . Reverting that commit and running yarn install again (to downgrade) fixed ......
Read more >
To v5 from v4 - webpack
Upgrade webpack 4 and its plugins/loaders · Make sure your build has no errors or warnings · Make sure to use mode ·...
Read more >
[Webpack 5] (minimal repro included!) __webpack_modules ...
Since its export is an empty object that's where Cannot read property 'call' of undefined comes from. I created a very simple reproduction...
Read more >
[Fix] TypeError [ERR_INVALID_ARG_TYPE]: The “path ...
[Fix] TypeError [ERR_INVALID_ARG_TYPE]: The “path” argument must be of type string. Received undefined · This story will cover three possible fixes: · 1:...
Read more >
Upgrading Webpack 4 → 5 | Square Corner Blog
We hesitantly ran npm install webpack@latest , worried it might be a huge undertaking. But after following the migration guide, we had a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found