Skip to content
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

EISDIR: illegal operation on a directory, read error after library upgrade #232

Closed
meirish opened this issue Jul 10, 2020 · 6 comments
Closed

Comments

@meirish
Copy link

meirish commented Jul 10, 2020

Hello!

We recently upgraded @auth0/auth0-spa-js to a more recent version and our production build started failing with this error:

cleaning up...
Build Error (UglifyWriter)
EISDIR: illegal operation on a directory, read

Notably v1.6.2 does not have this error, but anything from 1.7.0 does.

Reproducing it locally I found this log from the error dump:

ERROR Summary:

  - broccoliBuilderErrorStack: Error: EISDIR: illegal operation on a directory, read
    at Object.readSync (fs.js:523:3)
    at tryReadSync (fs.js:348:20)
    at Object.readFileSync (fs.js:385:19)
    at getSourceMapContent (/Users/meirish/code/cloud-ui/node_modules/broccoli-uglify-sourcemap/lib/get-sourcemap-content.js:18:30)
    at processFile (/Users/meirish/code/cloud-ui/node_modules/broccoli-uglify-sourcemap/lib/process-file.js:41:19)
    at Function.processFileParallel (/Users/meirish/code/cloud-ui/node_modules/broccoli-uglify-sourcemap/lib/worker.js:9:10)
    at MessagePort.<anonymous> (/Users/meirish/code/cloud-ui/node_modules/broccoli-uglify-sourcemap/node_modules/workerpool/dist/workerpool.min.js:25:16559)
    at MessagePort.emit (events.js:311:20)
    at MessagePort.onmessage (internal/worker/io.js:78:8)

What ends up happening here is srcURL.from() here: https://github.com/ember-cli/broccoli-uglify-sourcemap/blob/master/lib/get-sourcemap-content.js#L10 returns an empty string '' as the first item in the urls array when it gets to our app's vendor.js file, which then errors here: https://github.com/ember-cli/broccoli-uglify-sourcemap/blob/master/lib/get-sourcemap-content.js#L18 when it tries to read a directory instead of a file.

Removing the empty string from the array results in a successful build, but with this warning:

[UglifyWriter][WARN] (broccoli-uglify-sourcemap) "chunk.40bafbb6f4ed25560db2.js.map;", "chunk.cc45f8eb6b4af1864c92.js.map//#" referenced in "assets/vendor.js" could not be found

Which seems to point to ember-auto-import.

I'm uncertain where the issue is - is it in the auth0 source map urls, the source-map-url package that returns '', or maybe ember-auto-import. Has anyone ever seen this or have any guidance for where to look further?

meirish added a commit to meirish/broccoli-uglify-sourcemap that referenced this issue Jul 10, 2020
We ran across a case where `''` ended up in the `urls` array. I don't believe this is a fix for this issue, more of a workaround. See ember-cli#232 for more details.
@wagenet
Copy link

wagenet commented Aug 3, 2021

I'm hitting a similar issue.

@wagenet
Copy link

wagenet commented Aug 3, 2021

Interestingly, this is happening when I upgrade from @auth0/auth0-spa-js 1.16.0 to 1.16.1.

@ddoria921
Copy link

@meirish @wagenet Ran into something similar. This seems to be fixed in this PR #313

@NullVoxPopuli
Copy link
Contributor

Should be released, too: https://github.com/ember-cli/broccoli-terser-sourcemap/releases/tag/v4.1.1

does upgrading to 4.1.1 solve this for ye?

@ddoria921
Copy link

I was able to fix it by installing [email protected] in my project. I noticed that ember-cli-terser wasn't auto installing the latest version for whatever reason? Even though their package.json allows for it https://github.com/ember-cli/ember-cli-terser/blob/f3b5fd4875697c223fb1a9414c568c3aadbc017c/package.json#L25

@NullVoxPopuli
Copy link
Contributor

likely has to do with your lockfile -- generally when you need to update transient / sub-sub deps, I like to delete the entries in the lockfile, and let the package manager re-resolve what the correct version is.

anywho! most excellent!

I'm going to close this issue, and we can probably open a new one if a similar issue arises!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants