TypeError: Cannot read properties of undefined (reading 'getElementById')
See original GitHub issueIs there an existing issue for this?
- I have checked for existing issues https://github.com/getsentry/sentry-javascript/issues
- I have reviewed the documentation https://docs.sentry.io/
- I am using the latest SDK release https://github.com/getsentry/sentry-javascript/releases
How do you use Sentry?
Sentry Saas (sentry.io)
Which package are you using?
SDK Version
7.12.0
Framework Version
"next": "12.2.5"
Link to Sentry event
No response
Steps to Reproduce
- Install Next.JS
- Use next js edge functions
- See sentry error on server
Expected Result
Zero errors
Actual Result
TypeError: Cannot read properties of undefined (reading 'getElementById')
at node_modules/@sentry/nextjs/esm/performance/client.js:22:26
at node_modules/@sentry/nextjs/esm/performance/client.js:94:54
at node_modules/@sentry/tracing/esm/browser/browsertracing.js:99:0
at node_modules/@sentry/core/esm/integration.js:64:0
at <anonymous>
at node_modules/@sentry/core/esm/integration.js:60:0
at node_modules/@sentry/core/esm/baseclient.js:217:27
at node_modules/@sentry/hub/esm/hub.js:65:0
at node_modules/@sentry/core/esm/sdk.js:32:0
at node_modules/@sentry/browser/esm/sdk.js:110:2
at node_modules/@sentry/react/esm/sdk.js:18:2
at node_modules/@sentry/nextjs/esm/index.client.js:31:2
at sentry.server.config.ts:8:0
at webpack/bootstrap:21:0
at node_modules/react/index.js:4:2
at node_modules/react/index.js:4:2
at webpack/runtime/jsonp chunk loading:34:0
at api/github:middleware.js:1:17
Link to CODE
Issue Analytics
- State:
- Created a year ago
- Reactions:1
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Uncaught TypeError: Cannot read properties of undefined ...
Only the document object offers the function getElementById. id must be unique and therefore there is no need for a HTMLElement version of ......
Read more >Uncaught TypeError: Cannot read property of undefined In
Uncaught TypeError: Cannot read property of undefined error occurs in Chrome when you read a property or call a method on an undefined...
Read more >Uncaught TypeError: Cannot read property of null - iDiallo
You are accessing a property of an object that is null. For example, document.getElementById('stuff') returns null. So adding .value will cause ...
Read more >TypeError: Cannot read property 'value' of Null in JS
To solve the "Cannot read property 'value' of null" error, make sure that the JS script tag is placed at the bottom of...
Read more >[SOLVED] Cannot Read Property 'addEventListener' of Null in ...
When a method like getElementById() or querySelector() method is used to search for an element that doesn't exist in the DOM, it returns...
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 FreeTop 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
Top GitHub Comments
I had the same issue:
sentry.client.config.js
and/orsentry.server.config.js
erroneously bundling withexperimental-edge
functions.The root cause is obviously #5611 – and I am not familiar with the internals of the
withSentryConfig
Next.js webpack plugin – but is it possible that it is bundling the Sentry code in every API handler, even if it is marked asexperimental-edge
?Here is a temporary workaround for anyone else stuck. This will exclude the Sentry code in any edge functions.
Ask and you shall receive, @l1qu1d. 🙂 It happens I just merged this today: https://github.com/getsentry/sentry-javascript/pull/6207.
I’m going to close this for now, but if y’all are still having issues once that PR is released (in 7.20), please let us know.