oblador / react-native-performance

📐 Monitor and measure React Native performance

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

`TypeError: The "this" argument must be an instance of Performance.` with Node.js 20

mhassan1 opened this issue · comments

With Node.js 20, we are seeing a TypeError: The "this" argument must be an instance of Performance. error when using performance.now() from isomorphic-performance.

Steps to Reproduce:

  1. npm install react-native-performance isomorphic-performance
  2. node -p "require('isomorphic-performance').performance.now()" (with Node.js 20)

Actual Result:

TypeError [ERR_INVALID_ARG_TYPE]: The "this" argument must be an instance of Performance. Received undefined
    at now (node:internal/perf/performance:139:5)
    at createPerformance (/Users/marc/projects/zzz/react-native-performance/node_modules/react-native-performance/lib/commonjs/performance.js:17:22)
    at Object.<anonymous> (/Users/marc/projects/zzz/react-native-performance/node_modules/isomorphic-performance/src/node.js:6:18)

Expected Result:
No error

Details:
This issue is caused by performance brand checks that were introduced in nodejs/node#44483. This is reproducible by running node -p "perf_hooks.performance.now.call()" with Node.js 20.