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

5601 - fix next.js builds on node v16 #5619

Merged
merged 10 commits into from
Nov 21, 2022
Merged

5601 - fix next.js builds on node v16 #5619

merged 10 commits into from
Nov 21, 2022

Conversation

luu-alex
Copy link
Contributor

@luu-alex luu-alex commented Nov 14, 2022

Description

#5601
this PR fixes builds on next.js when being built with node v16, I believe global.request was being changed due to a polyfill issue and was giving an error TypeError: Cannot set property Request of # which has only a getter and its due to require('abortcontroller-polyfill/dist/polyfill-patch-fetch')

The solution is to only include require('abortcontroller-polyfill/dist/polyfill-patch-fetch') when abortController is not defined globally. I believe next.js provides their own global variables and would run into an error when Request was being polyfilled.

Please include a summary of the changes and be sure to follow our Contribution Guidelines.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)

Checklist for 1.x:

  • I have selected the correct base branch.
  • I have performed a self-review of my own code.
  • I have commented my code, particularly in hard-to-understand areas.
  • I have made corresponding changes to the documentation.
  • My changes generate no new warnings.
  • Any dependent changes have been merged and published in downstream modules.
  • I ran npm run dtslint with success and extended the tests and types if necessary.
  • I ran npm run test:cov and my test cases cover all the lines and branches of the added code.
  • I ran npm run build with success.
  • I have tested the built dist/web3.min.js in a browser.
  • I have tested my code on the live network.
  • I have checked the Deploy Preview and it looks correct.
  • I have updated the CHANGELOG.md file in the root folder.

Checklist for 4.x:

  • I have selected the correct 4.x base branch.
  • Within the description, the feature or issue is discussed in detail or an issue is linked.
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas.
  • I have added any required tests for the changes I made
  • I have made corresponding changes to the documentation
  • Any dependent changes have been merged and published in downstream modules.
  • I ran yarn successfully
  • I ran yarn lint successfully
  • I ran yarn build:web successfully
  • I ran yarn test:unit successfully
  • I ran yarn test:integration successfully
  • I ran compile:contracts successfully
  • I have tested my code.
  • I have updated the corresponding CHANGELOG.md file in the packages I have edited.

@render
Copy link

render bot commented Nov 14, 2022

@luu-alex luu-alex changed the base branch from 4.x to 1.x November 14, 2022 22:14
@luu-alex luu-alex changed the title 5601 - fix next.js builds on nodev16 5601 - fix next.js builds on node v16 Nov 14, 2022
@luu-alex luu-alex closed this Nov 14, 2022
@luu-alex luu-alex reopened this Nov 14, 2022
Copy link
Contributor

@avkos avkos left a comment

Choose a reason for hiding this comment

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

Some of the tests are falling. It will be great to fix them

@coveralls
Copy link

coveralls commented Nov 18, 2022

Pull Request Test Coverage Report for Build 3516153864

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • 444 unchanged lines in 8 files lost coverage.
  • Overall coverage increased (+0.02%) to 72.252%

Files with Coverage Reduction New Missed Lines %
packages/web3-core-requestmanager/src/jsonrpc.js 2 82.76%
packages/web3-providers-http/lib/index.js 8 78.18%
packages/web3-core-helpers/src/formatters.js 25 80.8%
packages/web3-core-helpers/src/errors.js 31 4.41%
packages/web3-utils/src/soliditySha3.js 55 5.13%
packages/web3-utils/src/index.js 58 36.89%
packages/web3-utils/src/utils.js 96 13.31%
packages/web3-eth-accounts/src/index.js 169 23.35%
Totals Coverage Status
Change from base Build 3490104649: 0.02%
Covered Lines: 3415
Relevant Lines: 4446

💛 - Coveralls

@luu-alex luu-alex merged commit 316bb6c into 1.x Nov 21, 2022
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.

6 participants