philhawksworth / netlify-plugin-minify-html

26 stars 8 forks source link

Error `Cannot read property 'substr' of undefined` #7

Open ehmicky opened 4 years ago

ehmicky commented 4 years ago

The following error happens in some builds:

The Minify HTML plugin failed.
Cannot read property 'substr' of undefined 
    /opt/buildhome/.netlify-build-plugins/node_modules/@node-minify/core/lib/compress.js:96:20 createDirectory
    /opt/buildhome/.netlify-build-plugins/node_modules/@node-minify/core/lib/compress.js:36:3 compress
    /opt/buildhome/.netlify-build-plugins/node_modules/@node-minify/core/lib/core.js:30:7 
    /opt/buildhome/.netlify-build-plugins/node_modules/@node-minify/core/lib/core.js:25:10 minify
    /opt/buildhome/.netlify-build-plugins/node_modules/netlify-plugin-minify-html/index.js:20:13 onSuccess
    src/plugins/child/run.js:15:9 Object.run
    src/plugins/child/main.js:34:61 handleEvent
    src/plugins/child/main.js:28:61 
    src/plugins/ipc.js:101:15 process.<anonymous>

Full deploy logs:

12:21:30 PM: Build ready to start
12:21:31 PM: build-image version: 342853e31ef590be8195dfbea64bbc4657de7b6b
12:21:31 PM: build-image tag: v3.3.16
12:21:31 PM: buildbot version: 0ffb969a1fc5a7aa9d2a93dd77dd40a990576807
12:21:32 PM: Fetching cached dependencies
12:21:32 PM: Starting to download cache of 95.8MB
12:21:34 PM: Finished downloading cache in 2.211946155s
12:21:34 PM: Starting to extract cache
12:21:37 PM: Finished extracting cache in 3.344332112s
12:21:37 PM: Finished fetching cache in 5.581124122s
12:21:37 PM: Starting to prepare the repo for build
12:21:37 PM: Netlify Large Media is enabled, running git commands with GIT_LFS_SKIP_SMUDGE=1
12:21:38 PM: Preparing Git Reference pull/43/head
12:21:39 PM: Starting build script
12:21:39 PM: Installing dependencies
12:21:39 PM: Python version set to 2.7
12:21:39 PM: Started restoring cached node version
12:21:42 PM: Finished restoring cached node version
12:21:43 PM: v10.21.0 is already installed.
12:21:44 PM: Now using node v10.21.0 (npm v6.14.4)
12:21:44 PM: Started restoring cached build plugins
12:21:44 PM: Finished restoring cached build plugins
12:21:44 PM: Attempting ruby version 2.6.2, read from environment
12:21:45 PM: 
12:21:45 PM: ** WARNING **
12:21:45 PM: Using custom ruby version 2.6.2, this will slow down the build.
12:21:45 PM: To ensure fast builds, set the RUBY_VERSION environment variable, or .ruby-version file, to an included ruby version.
12:21:45 PM: Included versions: 2.7.1
12:21:45 PM: 
12:21:45 PM: Required ruby-2.6.2 is not installed - installing.
12:21:45 PM: Searching for binary rubies, this might take some time.
12:21:45 PM: Found remote file https://rvm_io.global.ssl.fastly.net/binaries/ubuntu/16.04/x86_64/ruby-2.6.2.tar.bz2
12:21:45 PM: Checking requirements for ubuntu.
12:21:46 PM: Requirements installation successful.
12:21:46 PM: ruby-2.6.2 - #configure
12:21:46 PM: ruby-2.6.2 - #download
12:21:47 PM: No checksum for downloaded archive, recording checksum in user configuration.
12:21:47 PM: ruby-2.6.2 - #validate archive
12:21:52 PM: ruby-2.6.2 - #extract
12:21:55 PM: ruby-2.6.2 - #validate binary
12:21:55 PM: ruby-2.6.2 - #setup
12:21:56 PM: ruby-2.6.2 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.6.2@global
12:21:56 PM: ruby-2.6.2 - #importing gemset /opt/buildhome/.rvm/gemsets/global.gems........................................
12:21:56 PM: ruby-2.6.2 - #generating global wrappers.......
12:21:56 PM: ruby-2.6.2 - #gemset created /opt/buildhome/.rvm/gems/ruby-2.6.2
12:21:57 PM: ruby-2.6.2 - #importing gemsetfile /opt/buildhome/.rvm/gemsets/default.gems evaluated to empty gem list
12:21:57 PM: ruby-2.6.2 - #generating default wrappers.......
12:21:57 PM: Using /opt/buildhome/.rvm/gems/ruby-2.6.2
12:21:58 PM: Using ruby version 2.6.2
12:21:58 PM: Using PHP version 5.6
12:21:58 PM: 5.2 is already installed.
12:21:58 PM: Using Swift version 5.2
12:21:58 PM: Started restoring cached go cache
12:21:58 PM: Finished restoring cached go cache
12:21:58 PM: Installing Go version 1.12
12:22:04 PM: unset GOOS;
12:22:04 PM: unset GOARCH;
12:22:04 PM: export GOROOT='/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64';
12:22:04 PM: export PATH="/opt/buildhome/.gimme_cache/versions/go1.12.linux.amd64/bin:${PATH}";
12:22:04 PM: go version >&2;
12:22:04 PM: export GIMME_ENV="/opt/buildhome/.gimme_cache/env/go1.12.linux.amd64.env"
12:22:04 PM: go version go1.12 linux/amd64
12:22:04 PM: Installing missing commands
12:22:04 PM: Verify run directory
12:22:05 PM: ​
12:22:05 PM: ┌─────────────────────────────┐
12:22:05 PM: │        Netlify Build        │
12:22:05 PM: └─────────────────────────────┘
12:22:05 PM: ​
12:22:05 PM: ❯ Version
12:22:05 PM:   @netlify/build 2.0.10
12:22:05 PM: ​
12:22:05 PM: ❯ Flags
12:22:05 PM:   deployId: 5eeb402a8aaeff00078ae6c5
12:22:05 PM:   mode: buildbot
12:22:05 PM: ​
12:22:05 PM: ❯ Current directory
12:22:05 PM:   /opt/build/repo
12:22:05 PM: ​
12:22:05 PM: ❯ Config file
12:22:05 PM:   No config file was defined: using default values.
12:22:05 PM: ​
12:22:05 PM: ❯ Context
12:22:05 PM:   deploy-preview
12:22:05 PM: ​
12:22:05 PM: ❯ Loading plugins
12:22:05 PM:    - netlify-plugin-subfont@5.0.3 from Netlify app
12:22:05 PM:    - netlify-plugin-minify-html@0.2.3 from Netlify app
12:22:05 PM:    - netlify-plugin-is-website-vulnerable@1.0.8 from Netlify app
12:22:13 PM: ​
12:22:13 PM: ┌────────────────────────────────────────────────────┐
12:22:13 PM: │ 1. onPostBuild command from netlify-plugin-subfont │
12:22:13 PM: └────────────────────────────────────────────────────┘
12:22:13 PM: ​
12:22:13 PM: Running subfont version 5.0.2
12:22:13 PM: No input files specified, defaulting to file:///opt/build/repo/**/*.html
12:22:13 PM:  ✔ 0.001 secs: logEvents
12:22:13 PM:  ✔ 0.007 secs: loadAssets
12:22:13 PM:  ✔ 0.001 secs: populate
12:22:13 PM:  ✔ 0.000 secs: checkIncompatibleTypes
12:22:13 PM:  ✔ 0.000 secs: populate
12:22:13 PM:  ✔ 0.023 secs: compressJavaScript
12:22:13 PM:  ✔ 0.023 secs: writeAssetsToDisc
12:22:13 PM: HTML/JS/CSS size increase: 0 B
12:22:13 PM: Total savings: 0 B
12:22:13 PM: Output written to file:///opt/build/repo/
12:22:13 PM: ​
12:22:13 PM: (netlify-plugin-subfont onPostBuild completed in 394ms)
12:22:13 PM: ​
12:22:13 PM: ┌──────────────────────────────────────────────────────┐
12:22:13 PM: │ 2. onSuccess command from netlify-plugin-minify-html │
12:22:13 PM: └──────────────────────────────────────────────────────┘
12:22:13 PM: ​
12:22:13 PM: Minifiying HTML in the deploy context: deploy-preview
12:22:13 PM: Minifiying HTML with these options: Default
12:22:13 PM: ​
12:22:13 PM: ┌────────────────────────────────────────────┐
12:22:13 PM: │ Plugin "netlify-plugin-minify-html" failed │
12:22:13 PM: └────────────────────────────────────────────┘
12:22:13 PM: ​
12:22:13 PM:   Error message
12:22:13 PM:   TypeError: The Minify HTML plugin failed.
12:22:13 PM:   Cannot read property 'substr' of undefined
12:22:13 PM: ​
12:22:13 PM:   Plugin details
12:22:13 PM:   Package:        netlify-plugin-minify-html
12:22:13 PM:   Version:        0.2.3
12:22:13 PM:   Repository:     git+https://github.com/philhawksworth/netlify-plugin-minify-html.git
12:22:13 PM:   npm link:       https://www.npmjs.com/package/netlify-plugin-minify-html
12:22:13 PM:   Report issues:  https://github.com/philhawksworth/netlify-plugin-minify-html/issues
12:22:13 PM: ​
12:22:13 PM:   Error location
12:22:13 PM:   In "onSuccess" event in "netlify-plugin-minify-html" from Netlify app
12:22:13 PM:       at createDirectory (/opt/buildhome/.netlify-build-plugins/node_modules/@node-minify/core/lib/compress.js:96:20)
12:22:13 PM:       at compress (/opt/buildhome/.netlify-build-plugins/node_modules/@node-minify/core/lib/compress.js:36:3)
12:22:13 PM:       at /opt/buildhome/.netlify-build-plugins/node_modules/@node-minify/core/lib/core.js:30:7
12:22:13 PM:       at minify (/opt/buildhome/.netlify-build-plugins/node_modules/@node-minify/core/lib/core.js:25:10)
12:22:13 PM:       at onSuccess (/opt/buildhome/.netlify-build-plugins/node_modules/netlify-plugin-minify-html/index.js:20:13)
12:22:13 PM: ​
12:22:13 PM:   Resolved config
12:22:13 PM:   plugins:
12:22:13 PM:     - inputs: {}
12:22:13 PM:       origin: ui
12:22:13 PM:       package: netlify-plugin-subfont
12:22:13 PM:     - inputs: {}
12:22:13 PM:       origin: ui
12:22:13 PM:       package: netlify-plugin-minify-html
12:22:13 PM:     - inputs: {}
12:22:13 PM:       origin: ui
12:22:13 PM:       package: netlify-plugin-is-website-vulnerable
12:22:14 PM: ​
12:22:14 PM: ┌────────────────────────────────────────────────────────────────┐
12:22:14 PM: │ 3. onSuccess command from netlify-plugin-is-website-vulnerable │
12:22:14 PM: └────────────────────────────────────────────────────────────────┘
12:22:14 PM: ​
12:22:14 PM: Serving and scanning site from directory '/opt/build/repo'
12:22:23 PM:  ⚠  warning (DeprecationWarning)  OutgoingMessage.prototype._headers is deprecated
12:22:23 PM: [DEP0066] 
12:22:23 PM:     at new module.exports (/opt/buildhome/.netlify-build-plugins/node_modules/union/lib/response-stream.js:50:60)
12:22:23 PM:     at new module.exports (/opt/buildhome/.netlify-build-plugins/node_modules/union/lib/routing-stream.js:30:17)
12:22:23 PM:     at Server.requestHandler (/opt/buildhome/.netlify-build-plugins/node_modules/union/lib/core.js:27:25)
12:22:23 PM:     at Server.emit (events.js:310:20)
12:22:23 PM:     at parserOnIncoming (_http_server.js:786:12)
12:22:23 PM:     at HTTPParser.parserOnHeadersComplete (_http_common.js:119:17)
12:22:24 PM: No vulnerable JavaScript libraries detected
12:22:24 PM: ​
12:22:24 PM: (netlify-plugin-is-website-vulnerable onSuccess completed in 10.4s)
12:22:24 PM: ​
12:22:24 PM: ┌─────────────────────────────┐
12:22:24 PM: │   Netlify Build Complete    │
12:22:24 PM: └─────────────────────────────┘
12:22:24 PM: ​
12:22:24 PM: (Netlify Build completed in 19.4s)
12:22:24 PM: Caching artifacts
12:22:24 PM: Started saving build plugins
12:22:24 PM: Finished saving build plugins
12:22:24 PM: Started saving pip cache
12:22:24 PM: Finished saving pip cache
12:22:24 PM: Started saving emacs cask dependencies
12:22:24 PM: Finished saving emacs cask dependencies
12:22:24 PM: Started saving maven dependencies
12:22:24 PM: Finished saving maven dependencies
12:22:24 PM: Started saving boot dependencies
12:22:25 PM: Finished saving boot dependencies
12:22:25 PM: Started saving go dependencies
12:22:26 PM: Finished saving go dependencies
12:22:26 PM: Cached ruby version 2.6.2
12:22:26 PM: Build script success
12:22:26 PM: Starting to deploy site from ''
12:22:26 PM: Creating deploy tree 
12:22:27 PM: Creating deploy upload records
12:22:27 PM: 0 new files to upload
12:22:27 PM: 0 new functions to upload
12:22:27 PM: Starting post processing
12:22:27 PM: Post processing done
12:22:27 PM: Site is live
12:23:05 PM: Finished processing build request in 1m33.395649211s

Deploy URL. Bugsnag error. Repository commit.

Do you know what the error might be?

kolyabres commented 3 years ago

Had the same issue

image

rubykachu commented 3 years ago

Had the same issue :( image

leobenkel commented 3 years ago

Same issue here as well. on version 0.3.1