Skip to content

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

Closed
@mhassan1

Description

@mhassan1

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions