PerformanceObserver.observe() breaks inside next/image on chrome 69 #35200
Labels
bug
Issue was opened via the bug report template.
Image (next/image)
Related to Next.js Image Optimization.
Verify canary release
Provide environment information
What browser are you using? (if relevant)
Chrome 69.0.3497.106
How are you deploying your application? (if relevant)
No response
Describe the Bug
TL,DR
performanceObserver.observe()
throws an exception when not provided with theentryTypes
option in older browsers like Chrome 69.Description:
When using next/image, it internally attaches performance observer for LargestContentfulPaint events.
On older browsers like Chromium 69 this fails with the following error:
TypeError: Failed to execute 'observe' on 'PerformanceObserver': required member entryTypes is undefined.
While the current implementation follows the latest w3c specs which specifies that
performanceObserver.observe()
must be passed eitherentryTypes
array ortype
andbuffered
as options, next/image usses the later here: https://github.com/vercel/next.js/blob/canary/packages/next/client/image.tsx#L519But Chrome 69 enforces that
entryTypes
must be provided toobserve()
, hence it throws an exception.Expected Behavior
performanceObserver.observe()
should be wrapped inside a try/catch blockTo Reproduce
Use next/image in an older browser like Chrome 69
The text was updated successfully, but these errors were encountered: