Skip to content

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

New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Closed
mhassan1 opened this issue Oct 11, 2023 · 0 comments · Fixed by #101
Closed

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

mhassan1 opened this issue Oct 11, 2023 · 0 comments · Fixed by #101

Comments

@mhassan1
Copy link
Contributor

mhassan1 commented Oct 11, 2023

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.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant