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

fix(gatsby): fix proxy creation on read-only properties #31346

Merged
merged 2 commits into from
May 11, 2021

Conversation

pieh
Copy link
Contributor

@pieh pieh commented May 10, 2021

Description

Fix for:

1 | require('fs').constants

WebpackError: TypeError: 'get' on proxy: property 'constants' is a read-only 
and non-configurable data property on the proxy target but the proxy did not 
return its actual value (expected '[object Object]' but got '[object Object]')

read-only field need to return proper value (not proxy), otherwise it fails internal assertions and crashes the build. This PR adds check to see if property is writable and skips creating proxy if it's not.

Related Issues

Fixes #31199

@gatsbot gatsbot bot added the status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer label May 10, 2021
@pieh pieh changed the title Fix/fs constants proxy read only fix(gatsby): fix proxy creation on read-only properties May 10, 2021
@pieh pieh added topic: build Related to the Gatsby build process topic: ssr and removed status: triage needed Issue or pull request that need to be triaged and assigned to a reviewer labels May 10, 2021
@pieh pieh marked this pull request as ready for review May 10, 2021 15:04
@LekoArts LekoArts merged commit c210f1d into master May 11, 2021
@LekoArts LekoArts deleted the fix/fs-constants-proxy-read-only branch May 11, 2021 08:48
vladar pushed a commit that referenced this pull request May 11, 2021
vladar pushed a commit that referenced this pull request May 11, 2021
)

(cherry picked from commit c210f1d)

Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
@LekoArts LekoArts added the topic: DX Developer Experience (e.g. Fast Refresh, i18n, SSR, page creation, starters) label May 28, 2021
This was referenced Mar 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
topic: build Related to the Gatsby build process topic: DX Developer Experience (e.g. Fast Refresh, i18n, SSR, page creation, starters)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Build static HTML - WebpackError: render-page.js, get error on require('fs').constants
2 participants