-
Notifications
You must be signed in to change notification settings - Fork 27k
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
Rewrites with has
condition throws fromEntries
error in older browsers
#25207
Labels
bug
Issue was opened via the bug report template.
Comments
3 tasks
kodiakhq bot
pushed a commit
that referenced
this issue
May 18, 2021
…tes.ts` (#25208) ## Bug - [x] Related issues linked using `fixes #number` - [ ] Integration tests added Fixes #25207 Currently rewritten routes that use a `has` condition throw an `Object.fromEntries is not a function` error in older browsers. ## Documentation / Examples - [x] Make sure the linting passes ## Solution As mentioned in issue #25207, looks like last year the team decided not to include the `fromEntries` polyfill #15772 (comment). As such, we should avoid using non-polyfilled methods in core next.js code bundled in the browser. This PR's changes should result in the same object being returned, without using `fromEntries`.
jamsinclair
added a commit
to jamsinclair/next.js
that referenced
this issue
May 20, 2021
flybayer
pushed a commit
to blitz-js/next.js
that referenced
this issue
Jun 1, 2021
…tes.ts` (vercel#25208) ## Bug - [x] Related issues linked using `fixes #number` - [ ] Integration tests added Fixes vercel#25207 Currently rewritten routes that use a `has` condition throw an `Object.fromEntries is not a function` error in older browsers. ## Documentation / Examples - [x] Make sure the linting passes ## Solution As mentioned in issue vercel#25207, looks like last year the team decided not to include the `fromEntries` polyfill vercel#15772 (comment). As such, we should avoid using non-polyfilled methods in core next.js code bundled in the browser. This PR's changes should result in the same object being returned, without using `fromEntries`.
This issue has been automatically locked due to no recent activity. If you are running into a similar issue, please create a new issue with the steps to reproduce. Thank you. |
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
What version of Next.js are you using?
10.2.0
What version of Node.js are you using?
14.16.0
What browser are you using?
Safari 11.1.2
What operating system are you using?
iOS
How are you deploying your application?
next start
Describe the Bug
We've recently added some rewrites to our app that use the
has
rewrite condition.Since deploying we've seen an uptick in the following errors on users with non-major browsers (e.g. iOS Safari 11.1.2):
This correlates back to
next.js/packages/next/next-server/lib/router/utils/resolve-rewrites.ts
Lines 46 to 49 in d130f63
Looks like last year the team decided not to include the
fromEntries
polyfill #15772 (comment)Expected Behavior
Next.js browser bundled code does not use newer methods that aren't polyfilled
To Reproduce
Setup your
next.config.js
with a rewrite that uses thehas
condition and visit the page with a browser that does not supportfromEntries
.In the above example, you would visit
<nextjs host>/foo?test
The text was updated successfully, but these errors were encountered: