Next.js: [Next 9.5.4] Symbol.prototype.description polyfill raises TypeError

Created on 12 Oct 2020  路  5Comments  路  Source: vercel/next.js

Bug report

Describe the bug

The Symbol.prototype.description polyfill raises TypeError in Safari 11 or any other browser that does not support Symbol.prototype.description natively.

To Reproduce

  1. Open a web page that runs on Next.js 9.5.4 or 9.5.5 (https://nextjs.org is handy, or you can set up a starter app locally: npx create-next-app nextjs-blog --use-npm --example "https://github.com/vercel/next-learn-starter/tree/a24ee6c823/learn-starter" && cd nextjs-blog && npm install [email protected] && npm run dev)
  2. Open developer tools
  3. Enter Symbol.iterator.description in the console
  4. TypeError: Cannot convert a symbol to a string is raised

Expected behavior

Symbol.iterator.description === 'Symbol.iterator'

Screenshots

Screenshot 2020-10-13 2 56 59

System information

  • OS: iOS 11.4
  • Browser: Mobile Safari 11
  • Version of Next.js: 9.5.4-9.5.5
  • Version of Node.js: 12.10.0

Additional context

https://github.com/vercel/next.js/blob/1c4aecbeaf9de44cec3484f76d23ec8103f3bc50/packages/next-polyfill-module/src/index.js#L32-L38

/\((.+)\)/.exec(this)[1] will not work on any browser as RegExp.prototype.exec is spec'd to convert the argument to a string with the abstract operation ToString and ToString(symbol) throws a TypeError exception. See https://tc39.es/ecma262/#sec-regexp.prototype.exec and https://tc39.es/ecma262/#sec-tostring .

bug

Most helpful comment

+1
"next": "^9.5" => "next": "9.5.3"

All 5 comments

+1
"next": "^9.5" => "next": "9.5.3"

Thanks to Sentry we're noticing a GTM script is crashing in production in Safari v11 due to this.

I'm noticing a similar issue on my end with Next 9.5.4.

When I run Symbol.iterator.description like OP suggested, it errored on Chrome 61 - Chrome 65 (did not test 66 onwards). It was observed to be working without issues for Chrome 60, 59 and 58 (did not test versions older than this).

EDIT: Found that downgrading to Next 9.5.0 works

Could someone please send a PR fixing this?

18423

Was this page helpful?
0 / 5 - 0 ratings