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 #11

Closed
ehmicky opened this issue Jun 19, 2020 · 3 comments
Closed

EISDIR: illegal operation on a directory, read #11

ehmicky opened this issue Jun 19, 2020 · 3 comments

Comments

@ehmicky
Copy link

ehmicky commented Jun 19, 2020

Directories ending with *.html should be excluded from inlining, otherwise the following error makes the build fail:

Failed to inline critical CSS.
EISDIR: illegal operation on a directory, read 
@Tom-Bonnike

This comment has been minimized.

@ehmicky
Copy link
Author

ehmicky commented Jun 19, 2020

No, it's with both, but I posted on the wrong repository, sorry! :)

My first message's assumption was wrong because readdirp type option defaults to files.

Those are the deploy logs:

2:08:38 AM: Waiting for other deploys from your team to complete
2:15:50 AM: Build ready to start
2:15:52 AM: build-image version: 3031d4c9e432fd7016f6279fc9ad706f9205d845
2:15:52 AM: build-image tag: v3.3.17
2:15:52 AM: buildbot version: da42b14a989873e00cc6f36bc354c01953474181
2:15:52 AM: Fetching cached dependencies
2:15:52 AM: Failed to fetch cache, continuing with build
2:15:52 AM: Starting to prepare the repo for build
2:15:52 AM: No cached dependencies found. Cloning fresh repo
2:15:52 AM: git clone https://github.com/MiftaZ/My_first_Website
2:15:54 AM: Preparing Git Reference refs/heads/master
2:15:56 AM: Starting build script
2:15:56 AM: Installing dependencies
2:15:56 AM: Python version set to 2.7
2:15:57 AM: Downloading and installing node v10.21.0...
2:15:57 AM: Downloading https://nodejs.org/dist/v10.21.0/node-v10.21.0-linux-x64.tar.xz...
2:15:58 AM: Computing checksum with sha256sum
2:15:58 AM: Checksums matched!
2:16:00 AM: Now using node v10.21.0 (npm v6.14.4)
2:16:00 AM: Started restoring cached build plugins
2:16:00 AM: Finished restoring cached build plugins
2:16:00 AM: Attempting ruby version 2.6.2, read from environment
2:16:02 AM: Using ruby version 2.6.2
2:16:02 AM: Using PHP version 5.6
2:16:02 AM: 5.2 is already installed.
2:16:02 AM: Using Swift version 5.2
2:16:02 AM: Installing Hugo 0.63.2
2:16:03 AM: Hugo Static Site Generator v0.63.2-934EE21F/extended linux/amd64 BuildDate: 2020-01-27T12:20:42Z
2:16:03 AM: Started restoring cached go cache
2:16:03 AM: Finished restoring cached go cache
2:16:03 AM: Installing Go version 1.12
2:16:10 AM: unset GOOS;
2:16:10 AM: unset GOARCH;
2:16:10 AM: export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64';
2:16:10 AM: export PATH="/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64/bin:${PATH}";
2:16:10 AM: go version >&2;
2:16:10 AM: export GIMME_ENV="/opt/buildhome/.gimme_cache/env/go1.12.linux.amd64.env"
2:16:10 AM: go version go1.12 linux/amd64
2:16:10 AM: Installing missing commands
2:16:10 AM: Verify run directory
2:16:11 AM: ​
2:16:11 AM: ┌─────────────────────────────┐
2:16:11 AM: │        Netlify Build        │
2:16:11 AM: └─────────────────────────────┘
2:16:11 AM: ​
2:16:11 AM: ❯ Version
2:16:11 AM:   @netlify/build 2.0.10
2:16:11 AM: ​
2:16:11 AM: ❯ Flags
2:16:11 AM:   deployId: 5eec02067c2e000007559efd
2:16:11 AM:   mode: buildbot
2:16:11 AM: ​
2:16:11 AM: ❯ Current directory
2:16:11 AM:   /opt/build/repo
2:16:11 AM: ​
2:16:11 AM: ❯ Config file
2:16:11 AM:   /opt/build/repo/netlify.toml
2:16:11 AM: ​
2:16:11 AM: ❯ Context
2:16:11 AM:   production
2:16:11 AM: ​
2:16:11 AM: ❯ Loading plugins
2:16:11 AM:    - netlify-plugin-inline-source@1.0.4 from Netlify app
2:16:11 AM:    - netlify-plugin-inline-critical-css@1.1.1 from Netlify app
2:16:11 AM:    - netlify-plugin-submit-sitemap@0.1.4 from Netlify app
2:16:11 AM:    - netlify-plugin-inline-functions-env@1.0.4 from Netlify app
2:16:18 AM: ​
2:16:18 AM: ┌────────────────────────────────────────────────────────────────┐
2:16:18 AM: │ 1. onPreBuild command from netlify-plugin-inline-functions-env │
2:16:18 AM: └────────────────────────────────────────────────────────────────┘
2:16:18 AM: ​
2:16:18 AM: ​
2:16:18 AM: (netlify-plugin-inline-functions-env onPreBuild completed in 9ms)
2:16:18 AM: ​
2:16:18 AM: ┌──────────────────────────────────────────────────────────┐
2:16:18 AM: │ 2. onPostBuild command from netlify-plugin-inline-source │
2:16:18 AM: └──────────────────────────────────────────────────────────┘
2:16:18 AM: ​
2:16:19 AM: Sources successfully inlined!
2:16:19 AM: ​
2:16:19 AM: (netlify-plugin-inline-source onPostBuild completed in 1.6s)
2:16:19 AM: ​
2:16:19 AM: ┌────────────────────────────────────────────────────────────────┐
2:16:19 AM: │ 3. onPostBuild command from netlify-plugin-inline-critical-css │
2:16:19 AM: └────────────────────────────────────────────────────────────────┘
2:16:19 AM: ​
2:18:03 AM: ​
2:18:03 AM: ┌────────────────────────────────────────────────────┐
2:18:03 AM: │ Plugin "netlify-plugin-inline-critical-css" failed │
2:18:03 AM: └────────────────────────────────────────────────────┘
2:18:03 AM: ​
2:18:03 AM:   Error message
2:18:03 AM:   Error: Failed to inline critical CSS.
2:18:03 AM:   EISDIR: illegal operation on a directory, read
2:18:03 AM: ​
2:18:03 AM:   Plugin details
2:18:03 AM:   Package:        netlify-plugin-inline-critical-css
2:18:03 AM:   Version:        1.1.1
2:18:03 AM:   Repository:     git+https://github.com/Tom-Bonnike/netlify-plugin-inline-critical-css.git
2:18:03 AM:   npm link:       https://www.npmjs.com/package/netlify-plugin-inline-critical-css
2:18:03 AM:   Report issues:  https://github.com/Tom-Bonnike/netlify-plugin-inline-critical-css/issues
2:18:03 AM: ​
2:18:03 AM:   Error location
2:18:03 AM:   In "onPostBuild" event in "netlify-plugin-inline-critical-css" from Netlify app
2:18:03 AM: ​
2:18:03 AM:   Resolved config
2:18:03 AM:   build:
2:18:03 AM:     publish: /opt/build/repo/public
2:18:03 AM:   headers:
2:18:03 AM:     - for: '*.webmanifest'
2:18:03 AM:       values:
2:18:03 AM:         Content-Type: application/manifest+json; charset=UTF-8
2:18:03 AM:     - for: index.xml
2:18:03 AM:       values:
2:18:03 AM:         Content-Type: application/rss+xml
2:18:03 AM:   plugins:
2:18:03 AM:     - inputs: {}
2:18:03 AM:       origin: ui
2:18:03 AM:       package: netlify-plugin-inline-source
2:18:03 AM:     - inputs: {}
2:18:03 AM:       origin: ui
2:18:03 AM:       package: netlify-plugin-inline-critical-css
2:18:03 AM:     - inputs: {}
2:18:03 AM:       origin: ui
2:18:03 AM:       package: netlify-plugin-submit-sitemap
2:18:03 AM:     - inputs: {}
2:18:03 AM:       origin: ui
2:18:03 AM:       package: netlify-plugin-inline-functions-env
2:18:03 AM: Caching artifacts
2:18:03 AM: Started saving build plugins
2:18:03 AM: Finished saving build plugins
2:18:03 AM: Started saving pip cache
2:18:04 AM: Finished saving pip cache
2:18:04 AM: Started saving emacs cask dependencies
2:18:04 AM: Finished saving emacs cask dependencies
2:18:04 AM: Started saving maven dependencies
2:18:04 AM: Finished saving maven dependencies
2:18:04 AM: Started saving boot dependencies
2:18:04 AM: Finished saving boot dependencies
2:18:04 AM: Started saving go dependencies
2:18:05 AM: Finished saving go dependencies
2:18:09 AM: Error running command: Build script returned non-zero exit code: 1
2:18:09 AM: Failing build: Failed to build site
2:18:09 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1
2:18:09 AM: Finished processing build request in 2m17.193731922s

The repository and specific commit is this one.

@Tom-Bonnike Tom-Bonnike changed the title Fails on *.html directories EISDIR: illegal operation on a directory, read Jun 20, 2020
@Tom-Bonnike
Copy link
Owner

Tom-Bonnike commented Jun 20, 2020

Sooo critical fails when trying to open the stylesheet to read its content, I’m pretty sure this is caused by an invalid <link rel="stylesheet" href="…" />, probably because the href is pointing to a directory. It’s a pain to confirm because there’s so many <link> tags in the repo and critical’s error doesn’t give much info 😞

I guess the fix would be to improve the condition here to ignore directories, or improve the error so it’s not so cryptic.
https://github.com/addyosmani/critical/blob/168ba12a9c4a88d1b7633d0e75495b6dc62805d6/src/file.js#L667-L671

But it’s anyway an user error, so I’d say failing is expected.

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

2 participants