Repository navigation
Continue resolving on ERR_ACCESS_DENIED in Node's resolver - #15042
Conversation
Using Gemini Code AssistThe 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
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 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
14dd9a7 to
692109c
Compare
There was a problem hiding this comment.
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.mjsto treatERR_ACCESS_DENIEDlikeERR_MODULE_NOT_FOUNDfor theNODE_PATHfallback 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 viaNODE_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.
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