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

Error when entryPoints is absolute #200

Open
ehmicky opened this issue Sep 1, 2020 · 0 comments
Open

Error when entryPoints is absolute #200

ehmicky opened this issue Sep 1, 2020 · 0 comments
Labels
bug Something isn't working

Comments

@ehmicky
Copy link
Contributor

ehmicky commented Sep 1, 2020

When entryPoints contains /, the following error happens:

EACCES: permission denied, scandir '//root' 
    fs.js:872:3 Object.readdirSync
    /opt/buildhome/.netlify-build-plugins/node_modules/@nodelib/fs.scandir/out/providers/sync.js:14:33 readdirWithFileTypes
    /opt/buildhome/.netlify-build-plugins/node_modules/@nodelib/fs.scandir/out/providers/sync.js:8:16 Object.read
    /opt/buildhome/.netlify-build-plugins/node_modules/@nodelib/fs.scandir/out/index.js:16:17 SyncReader.scandirSync [as _scandir]
    /opt/buildhome/.netlify-build-plugins/node_modules/@nodelib/fs.walk/out/readers/sync.js:28:34 SyncReader._handleDirectory
    /opt/buildhome/.netlify-build-plugins/node_modules/@nodelib/fs.walk/out/readers/sync.js:23:18 SyncReader._handleQueue
    /opt/buildhome/.netlify-build-plugins/node_modules/@nodelib/fs.walk/out/readers/sync.js:15:14 SyncReader.read
    /opt/buildhome/.netlify-build-plugins/node_modules/@nodelib/fs.walk/out/providers/sync.js:11:29 SyncProvider.read
    /opt/buildhome/.netlify-build-plugins/node_modules/@nodelib/fs.walk/out/index.js:18:21 ReaderSync.walkSync [as _walkSync]
    /opt/buildhome/.netlify-build-plugins/node_modules/fast-glob/out/readers/sync.js:13:21 ReaderSync.dynamic
    /opt/buildhome/.netlify-build-plugins/node_modules/fast-glob/out/providers/sync.js:18:33 ProviderSync.api
    /opt/buildhome/.netlify-build-plugins/node_modules/fast-glob/out/providers/sync.js:13:30 ProviderSync.read
    /opt/buildhome/.netlify-build-plugins/node_modules/fast-glob/out/index.js:58:18 getWorks
    /opt/buildhome/.netlify-build-plugins/node_modules/fast-glob/out/index.js:19:23 AsyncFunction.sync
    /opt/buildhome/.netlify-build-plugins/node_modules/netlify-plugin-checklinks/node_modules/globby/index.js:149:51 
    /opt/buildhome/.netlify-build-plugins/node_modules/netlify-plugin-checklinks/node_modules/globby/index.js:148:15 AsyncFunction.module.exports.sync
    /opt/buildhome/.netlify-build-plugins/node_modules/netlify-plugin-checklinks/lib/index.js:48:27 onPostBuild
    src/plugins/child/run.js:13:9 Object.run
    src/plugins/child/main.js:34:61 handleEvent
    src/plugins/child/main.js:28:61

I am not quite sure how this happens considering the cwd option is passed to globby:

inputUrls: globby.sync(entryPoints, { cwd: root }),

And the root is:

const root = PUBLISH_DIR;

Which in guaranteed to be within the repository directory (it was public for the build above). But somehow, a root directory was checked instead, which led to a permission error. Maybe the build contained a symlink to it?

The full build logs:

11:29:53 PM: Build ready to start
11:29:55 PM: build-image version: b0258b965567defc4a2d7e2f2dec2e00c8f73ad6
11:29:55 PM: build-image tag: v3.4.1
11:29:55 PM: buildbot version: fcbc7a79f7372e5995cf02954ef19fc48d20c871
11:29:55 PM: Fetching cached dependencies
11:29:55 PM: Starting to download cache of 474.4MB
11:29:57 PM: Finished downloading cache in 2.674791064s
11:29:57 PM: Starting to extract cache
11:30:05 PM: Finished extracting cache in 7.18221961s
11:30:05 PM: Finished fetching cache in 9.989909385s
11:30:05 PM: Starting to prepare the repo for build
11:30:06 PM: Preparing Git Reference pull/217/head
11:30:09 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'make build-preview' versus 'make build' in the Netlify UI
11:30:09 PM: Starting build script
11:30:09 PM: Installing dependencies
11:30:09 PM: Python version set to 3.7
11:30:10 PM: Started restoring cached node version
11:30:12 PM: Finished restoring cached node version
11:30:13 PM: v12.18.0 is already installed.
11:30:13 PM: Now using node v12.18.0 (npm v6.14.4)
11:30:13 PM: Started restoring cached build plugins
11:30:13 PM: Finished restoring cached build plugins
11:30:14 PM: Attempting ruby version 2.7.1, read from environment
11:30:15 PM: Using ruby version 2.7.1
11:30:15 PM: Using bundler version 2.1.4 from Gemfile.lock
11:30:15 PM: Using PHP version 5.6
11:30:15 PM: Started restoring cached ruby gems
11:30:15 PM: Finished restoring cached ruby gems
11:30:15 PM: Installing pip dependencies
11:30:15 PM: Started restoring cached pip cache
11:30:15 PM: Finished restoring cached pip cache
11:30:20 PM: Collecting appdirs==1.4.4
11:30:20 PM:   Using cached appdirs-1.4.4-py2.py3-none-any.whl (9.6 kB)
11:30:20 PM: Processing /opt/buildhome/.cache/pip/wheels/a2/19/da/a15d4e2bedf3062c739b190d5cb5b7b2ecfbccb6b0d93c861b/distlib-0.3.0-py3-none-any.whl
11:30:20 PM: Collecting docutils==0.16b0.dev0
11:30:20 PM:   Using cached docutils-0.16b0.dev0-py2.py3-none-any.whl (548 kB)
11:30:20 PM: Collecting filelock==3.0.12
11:30:20 PM:   Using cached filelock-3.0.12-py3-none-any.whl (7.6 kB)
11:30:20 PM: Collecting Pygments==2.6.1
11:30:20 PM:   Using cached Pygments-2.6.1-py3-none-any.whl (914 kB)
11:30:20 PM: Collecting six==1.14.0
11:30:20 PM:   Using cached six-1.14.0-py2.py3-none-any.whl (10 kB)
11:30:20 PM: Collecting virtualenv==20.0.21
11:30:20 PM:   Using cached virtualenv-20.0.21-py2.py3-none-any.whl (4.7 MB)
11:30:21 PM: Collecting importlib-metadata<2,>=0.12; python_version < "3.8"
11:30:21 PM:   Using cached importlib_metadata-1.7.0-py2.py3-none-any.whl (31 kB)
11:30:21 PM: Collecting zipp>=0.5
11:30:21 PM:   Using cached zipp-3.1.0-py3-none-any.whl (4.9 kB)
11:30:21 PM: Installing collected packages: appdirs, distlib, docutils, filelock, Pygments, six, zipp, importlib-metadata, virtualenv
11:30:23 PM: Successfully installed Pygments-2.6.1 appdirs-1.4.4 distlib-0.3.0 docutils-0.16b0.dev0 filelock-3.0.12 importlib-metadata-1.7.0 six-1.14.0 virtualenv-20.0.21 zipp-3.1.0
11:30:23 PM: WARNING: You are using pip version 20.2b1; however, version 20.2.2 is available.
11:30:23 PM: You should consider upgrading via the '/opt/buildhome/python3.7/bin/python3.7 -m pip install --upgrade pip' command.
11:30:23 PM: Pip dependencies installed
11:30:23 PM: 5.2 is already installed.
11:30:23 PM: Using Swift version 5.2
11:30:23 PM: Installing Hugo 0.74.3
11:30:23 PM: Hugo Static Site Generator v0.74.3-DA0437B4/extended linux/amd64 BuildDate: 2020-07-23T16:30:30Z
11:30:23 PM: Started restoring cached go cache
11:30:23 PM: Finished restoring cached go cache
11:30:23 PM: go version go1.14.4 linux/amd64
11:30:23 PM: go version go1.14.4 linux/amd64
11:30:23 PM: Installing missing commands
11:30:23 PM: Verify run directory
11:30:25 PM: ​
11:30:25 PM: ┌─────────────────────────────┐
11:30:25 PM: │        Netlify Build        │
11:30:25 PM: └─────────────────────────────┘
11:30:25 PM: ​
11:30:25 PM: ❯ Version
11:30:25 PM:   @netlify/build 3.3.0
11:30:25 PM: ​
11:30:25 PM: ❯ Flags
11:30:25 PM:   deployId: 5f4d6bd1b4d64500076d85bc
11:30:25 PM:   mode: buildbot
11:30:25 PM: ​
11:30:25 PM: ❯ Current directory
11:30:25 PM:   /opt/build/repo
11:30:25 PM: ​
11:30:25 PM: ❯ Config file
11:30:25 PM:   /opt/build/repo/netlify.toml
11:30:25 PM: ​
11:30:25 PM: ❯ Context
11:30:25 PM:   deploy-preview
11:30:25 PM: ​
11:30:25 PM: ❯ Loading plugins
11:30:25 PM:    - [email protected] from netlify.toml
11:30:32 PM: ​
11:30:32 PM: ┌────────────────────────────────────┐
11:30:32 PM: │ 1. build.command from netlify.toml │
11:30:32 PM: └────────────────────────────────────┘
11:30:32 PM: ​
11:30:32 PM: $ make build-preview
11:30:33 PM: Deleting public (build output) directory
11:30:33 PM: Hugo Static Site Generator v0.74.3-DA0437B4/extended linux/amd64 BuildDate: 2020-07-23T16:30:30Z
11:30:33 PM: hugo --path-warnings --verbose --buildDrafts --buildFuture
11:30:33 PM: INFO 2020/08/31 21:30:33 Using config file:
11:30:33 PM: Building sites … INFO 2020/08/31 21:30:33 syncing static files to /opt/build/repo/public/
11:30:38 PM:                    | EN-US
11:30:38 PM: -------------------+--------
11:30:38 PM:   Pages            |  1870
11:30:38 PM:   Paginator pages  |   337
11:30:38 PM:   Non-page files   |  1197
11:30:38 PM:   Static files     |    85
11:30:38 PM:   Processed images |     0
11:30:38 PM:   Aliases          |   234
11:30:38 PM:   Sitemaps         |     1
11:30:38 PM:   Cleaned          |     0
11:30:38 PM: WARN 2020/08/31 21:30:38 Duplicate target paths: /opt/build/repo/public/how-to/hosted-microsoft-lync-at-rackspace-deployment-guide/index.html (2)
11:30:38 PM: Total in 5475 ms
11:30:38 PM: ​
11:30:38 PM: (build.command completed in 5.6s)
11:30:38 PM: ​
11:30:38 PM: ┌───────────────────────────────────────────────────────┐
11:30:38 PM: │ 2. onPostBuild command from netlify-plugin-checklinks │
11:30:38 PM: └───────────────────────────────────────────────────────┘
11:30:38 PM: ​
11:30:38 PM: ​
11:30:38 PM: ┌───────────────────────────────────────────────────┐
11:30:38 PM: │ Plugin "netlify-plugin-checklinks" internal error │
11:30:38 PM: └───────────────────────────────────────────────────┘
11:30:38 PM: ​
11:30:38 PM:   Error message
11:30:38 PM:   Error: EACCES: permission denied, scandir '//root'
11:30:38 PM: ​
11:30:38 PM:   Plugin details
11:30:38 PM:   Package:        netlify-plugin-checklinks
11:30:38 PM:   Version:        4.1.1
11:30:38 PM:   Repository:     git://github.com/munter/netlify-plugin-checklinks.git
11:30:38 PM:   npm link:       https://www.npmjs.com/package/netlify-plugin-checklinks
11:30:38 PM:   Report issues:  https://github.com/munter/netlify-plugin-checklinks/issues
11:30:38 PM: ​
11:30:38 PM:   Error location
11:30:38 PM:   In "onPostBuild" event in "netlify-plugin-checklinks" from netlify.toml
11:30:38 PM:       at Object.readdirSync (fs.js:872:3)
11:30:38 PM:       at readdirWithFileTypes (/opt/buildhome/.netlify-build-plugins/node_modules/@nodelib/fs.scandir/out/providers/sync.js:14:33)
11:30:38 PM:       at Object.read (/opt/buildhome/.netlify-build-plugins/node_modules/@nodelib/fs.scandir/out/providers/sync.js:8:16)
11:30:38 PM:       at SyncReader.scandirSync [as _scandir] (/opt/buildhome/.netlify-build-plugins/node_modules/@nodelib/fs.scandir/out/index.js:16:17)
11:30:38 PM:       at SyncReader._handleDirectory (/opt/buildhome/.netlify-build-plugins/node_modules/@nodelib/fs.walk/out/readers/sync.js:28:34)
11:30:38 PM:       at SyncReader._handleQueue (/opt/buildhome/.netlify-build-plugins/node_modules/@nodelib/fs.walk/out/readers/sync.js:23:18)
11:30:38 PM:       at SyncReader.read (/opt/buildhome/.netlify-build-plugins/node_modules/@nodelib/fs.walk/out/readers/sync.js:15:14)
11:30:38 PM:       at SyncProvider.read (/opt/buildhome/.netlify-build-plugins/node_modules/@nodelib/fs.walk/out/providers/sync.js:11:29)
11:30:38 PM:       at ReaderSync.walkSync [as _walkSync] (/opt/buildhome/.netlify-build-plugins/node_modules/@nodelib/fs.walk/out/index.js:18:21)
11:30:38 PM:       at ReaderSync.dynamic (/opt/buildhome/.netlify-build-plugins/node_modules/fast-glob/out/readers/sync.js:13:21)
11:30:38 PM:       at ProviderSync.api (/opt/buildhome/.netlify-build-plugins/node_modules/fast-glob/out/providers/sync.js:18:33)
11:30:38 PM:       at ProviderSync.read (/opt/buildhome/.netlify-build-plugins/node_modules/fast-glob/out/providers/sync.js:13:30)
11:30:38 PM:       at Array.map (<anonymous>)
11:30:38 PM:       at getWorks (/opt/buildhome/.netlify-build-plugins/node_modules/fast-glob/out/index.js:58:18)
11:30:38 PM:       at AsyncFunction.sync (/opt/buildhome/.netlify-build-plugins/node_modules/fast-glob/out/index.js:19:23)
11:30:38 PM:       at /opt/buildhome/.netlify-build-plugins/node_modules/netlify-plugin-checklinks/node_modules/globby/index.js:149:51
11:30:38 PM:       at Array.reduce (<anonymous>)
11:30:38 PM:       at AsyncFunction.module.exports.sync (/opt/buildhome/.netlify-build-plugins/node_modules/netlify-plugin-checklinks/node_modules/globby/index.js:148:15)
11:30:38 PM:       at onPostBuild (/opt/buildhome/.netlify-build-plugins/node_modules/netlify-plugin-checklinks/lib/index.js:48:27)
11:30:38 PM:       at Object.run (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/child/run.js:13:9)
11:30:38 PM:       at handleEvent (/opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/child/main.js:34:61)
11:30:38 PM:       at /opt/buildhome/.netlify-build-nvm/versions/node/v12.16.3/lib/node_modules/@netlify/build/src/plugins/child/main.js:28:61
11:30:38 PM: ​
11:30:38 PM:   Error properties
11:30:38 PM:   { errno: -13, syscall: 'scandir', code: 'EACCES', path: '//root' }
11:30:38 PM: ​
11:30:38 PM:   Resolved config
11:30:38 PM:   build:
11:30:38 PM:     command: make build-preview
11:30:38 PM:     commandOrigin: config
11:30:38 PM:     environment:
11:30:38 PM:       - ALGOLIA_ADMIN_KEY
11:30:38 PM:       - ALGOLIA_APPLICATION_ID
11:30:38 PM:       - ALGOLIA_INDEX
11:30:38 PM:       - ALGOLIA_SEARCH_KEY
11:30:38 PM:       - REVIEW_ID
11:30:38 PM:       - HUGO_VERSION
11:30:38 PM:     publish: /opt/build/repo/public
11:30:38 PM:   headers:
11:30:38 PM:     - for: /img/*      values:        Cache-Control: 'public, s-max-age=604800'    - for: /*.css      values:        Cache-Control: 'public, s-max-age=604800'    - for: /*.js      values:        Cache-Control: 'public, s-max-age=604800'  plugins:    - inputs:        checkExternal: false        followSourceMaps: false        pretty: true        recursive: true      origin: config      package: netlify-plugin-checklinksCaching artifacts
11:30:38 PM: Started saving ruby gems
11:30:38 PM: Finished saving ruby gems
11:30:38 PM: Started saving build plugins
11:30:38 PM: Finished saving build plugins
11:30:38 PM: Started saving pip cache
11:30:38 PM: Finished saving pip cache
11:30:38 PM: Started saving emacs cask dependencies
11:30:38 PM: Finished saving emacs cask dependencies
11:30:38 PM: Started saving maven dependencies
11:30:38 PM: Finished saving maven dependencies
11:30:38 PM: Started saving boot dependencies
11:30:38 PM: Finished saving boot dependencies
11:30:38 PM: Started saving go dependencies
11:30:38 PM: Finished saving go dependencies
11:30:39 PM: Error running command: Build script returned non-zero exit code: 1
11:30:39 PM: Failing build: Failed to build site
11:30:39 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
11:30:39 PM: Finished processing build request in 43.9575036s

And the commit/repository.

This is the netlify.toml:

[build.environment]
  HUGO_VERSION = "0.74.3"

[build]
  command = "make build"
  publish = "public"

[context.deploy-preview]
  command = "make build-preview"
  publish = "public"


[[headers]]
  for = "/img/*"
  [headers.values]
    Cache-Control = "public, s-max-age=604800"
[[headers]]
  for = "/*.css"
  [headers.values]
    Cache-Control = "public, s-max-age=604800"
[[headers]]
  for = "/*.js"
  [headers.values]
    Cache-Control = "public, s-max-age=604800"

[[plugins]]
package = "netlify-plugin-checklinks"
  [plugins.inputs]
  # An array of glob patterns for pages on your site
  # Recursive traversal will start from these
  entryPoints = [
    "/",
  ]
    # Recurse through all the links and asset references on your page, starting
  # at the entrypoints
  recursive = true

  # Checklinks outputs TAP (https://testanything.org/tap-version-13-specification.html)
  # by default. Enabling pretty mode makes the output easier on the eyes.
  pretty = true

  # You can mark some check as skipped, which will block checklinks
  # from ever attempting to execute them.
  # skipPatterns is an array of strings you can match against failing reports
  skipPatterns = ["/blog", "/docs", "/docs/*"]

  # You can mark some check as todo, which will execute the check, but allow failures.
  # todoPatterns is an array of strings you can match against failing reports
  todoPatterns = ["/support/*"]

  # Report on all broken links to external pages.
  # Enabling this will make your tests more brittle, since you can't control
  # external pages.
  checkExternal = false

  # Enable to check references to source maps, source map sources etc.
  # Many build tools don't emit working references, so this is disabled by default
  followSourceMaps = false
@Munter Munter added the bug Something isn't working label Sep 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants