[11.1.3-canary.104] ReferenceError: PerformanceObserver is not defined
See original GitHub issueWhat version of Next.js are you using?
11.1.3-canary.104
What version of Node.js are you using?
14.18.0
What browser are you using?
Firefox
What operating system are you using?
Windows
How are you deploying your application?
Vercel
Describe the Bug
With the latest canary, I am noticing tests failing due to PerformanceObserver
not being defined. This issue didn’t happen in in the previous canary or in LTS.
Expected Behavior
My tests shouldn’t fail or if I need to add a mock for this, there should be some updated documentation to support.
Reproduce
I have a modal that has an Image
component, I am seeing this error in my jest logs:
Error: Uncaught [ReferenceError: PerformanceObserver is not defined]
console.error
The above error occurred in the <Image> component:
at Image (/home/wade/Code/Clients/rhythm-marketing/node_modules/next/client/image.tsx:307:3)
at div
at Modalstyled__ModalIcon (/home/wade/Code/Clients/rhythm-marketing/node_modules/styled-components/src/models/StyledComponent.js:252:3)
at div
at Layout__FlexBox (/home/wade/Code/Clients/rhythm-marketing/node_modules/styled-components/src/models/StyledComponent.js:252:3)
at div
at Modalstyled__ModalDialog (/home/wade/Code/Clients/rhythm-marketing/node_modules/styled-components/src/models/StyledComponent.js:252:3)
at div
at Modalstyled__ModalPageContainer (/home/wade/Code/Clients/rhythm-marketing/node_modules/styled-components/src/models/StyledComponent.js:252:3)
at Modal (/home/wade/Code/Clients/rhythm-marketing/src/components/Modal/Modal.component.tsx:37:3)
at Object.<anonymous>.exports.ThemeProvider (/home/wade/Code/Clients/rhythm-marketing/node_modules/styled-components/src/models/ThemeProvider.js:24:7)
at I18nextProvider (/home/wade/Code/Clients/rhythm-marketing/node_modules/react-i18next/dist/commonjs/I18nextProvider.js:13:19)
at Providers (/home/wade/Code/Clients/rhythm-marketing/test-utils.tsx:48:26)
Issue Analytics
- State:
- Created 2 years ago
- Reactions:4
- Comments:6 (3 by maintainers)
Top Results From Across the Web
ReferenceError: performance is not defined when using ...
I am getting an error ReferenceError: performance ...
Read more >PerformanceObserver() - Web APIs - MDN Web Docs
The PerformanceObserver() constructor creates a new PerformanceObserver object with the given observer callback. The observer callback is ...
Read more >PerformanceObserver open handle · Issue #11051 - GitHub
Bug Report i use prom-client version 13.1.0. when i run jest --detectOpenHandles i get Jest has detected the following 1 open handle ...
Read more >Performance measurement APIs | Node.js v19.3.0 ...
Wraps a function within a new function that measures the running time of the wrapped function. A PerformanceObserver must be subscribed to the...
Read more >Performance observer - Efficient access to performance data
New in Chrome 52, the Performance Observer interface provides more ... It's not subject to buffer limits (most buffers are set to 150...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hi, the above PR is now available in
v12.0.1
of Next.js, please update and give it a try!I was able to work around this for now by adding this to my
jest.setup.js