Skip to content

Continue resolving on ERR_ACCESS_DENIED in Node's resolver - #15042

Merged
bep merged 1 commit into
gohugoio:masterfrom
bep:fix/accessdenied-15041
Jun 15, 2026
Merged

bep merged 1 commit into
gohugoio:masterfrom
bep:fix/accessdenied-15041

Conversation

@bep

@bep bep commented Jun 15, 2026 •

Copy link
Copy Markdown
Member

And then rethrow the ERR_ACCESS_DENIED if we cannot recover.

There's more details in #15041, but this error has been seen on Netlify with the CJS loader because of how Netlify has their node_modules cache folder set up.

Fixes #15041

@gemini-code-assist

Copy link
Copy Markdown
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

And then rethrow the ERR_ACCESS_DENIED if we cannot recover.

There's more details in gohugoio#15041, but this error has been seen on Netlify with the CJS because of how Netlify has their node_modules cache folder set up.

Fixes gohugoio#15041
@bep
bep force-pushed the fix/accessdenied-15041 branch from 14dd9a7 to 692109c Compare June 15, 2026 10:50
@bep
bep requested a review from Copilot June 15, 2026 13:19

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR improves Hugo’s Node.js ESM resolver hook so that module resolution can continue (via NODE_PATH) when Node aborts normal resolution with ERR_ACCESS_DENIED under the Node permission model (seen in environments like Netlify where node_modules caches can exist outside Hugo’s allow-listed read paths).

Changes:

  • Extend common/hexec/esmloader.mjs to treat ERR_ACCESS_DENIED like ERR_MODULE_NOT_FOUND for the NODE_PATH fallback path (re-throwing the original error if fallback fails).
  • Add an integration test that reproduces the “resolver walks up into a restricted ancestor node_modules” scenario and asserts the build still succeeds via NODE_PATH.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
common/hexec/esmloader.mjs Allows ESM resolution to continue on ERR_ACCESS_DENIED and documents the rationale/behavior.
resources/resource_transformers/cssjs/postcss_integration_test.go Adds a CI-only integration test that simulates Netlify-style cache layout and validates the fallback behavior.

đź’ˇ Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@bep
bep merged commit 134674f into gohugoio:master Jun 15, 2026
4 checks passed
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

Successfully merging this pull request may close these issues.

ERR_ACCESS_DENIED issue on e.g. Netlify with Node's CJS resolver (at least)

2 participants