最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

TypeError: Cannot read properties of undefined (reading 'sentry') for Next.js site with Sentry - Stack Overflow

programmeradmin2浏览0评论

Trying to deploy a nextjs website with Sentry monitoring on hostinger. Sentry works when running locally, and the site doesnt crash, but it errors out and crashes when deployed on hostinger: console error screenshot

512-fd82f752a414c660.js:525 TypeError: Cannot read properties of undefined (reading 'sentry')
    at 164.1b37e5fe1265aae3.js:1:21471
    at Array.reduce (<anonymous>)
    at q (164.1b37e5fe1265aae3.js:1:21456)
    at n (164.1b37e5fe1265aae3.js:1:34922)
    at 164.1b37e5fe1265aae3.js:17:64552
    at oO (164.1b37e5fe1265aae3.js:17:67668)
    at oA (164.1b37e5fe1265aae3.js:17:63598)
    at 164.1b37e5fe1265aae3.js:17:63405
    at oP (164.1b37e5fe1265aae3.js:17:63412)
    at ov (164.1b37e5fe1265aae3.js:17:60278)
    at og (164.1b37e5fe1265aae3.js:17:58850)
    at S (164.1b37e5fe1265aae3.js:25:1364)
    at MessagePort.T (164.1b37e5fe1265aae3.js:25:1894)

nowhere in my code is .sentry called on any object. This is what my sentry.client.config.ts looks like


Sentry.init({
    dsn: "https://c14ecceb9e4b2cb37fcf625c50cb91db@o4508458061332480.ingest.us.sentry.io/4508458063233024",

    integrations: [
        Sentry.replayIntegration(),
        Sentry.feedbackIntegration({
            // Additional SDK configuration goes in here, for example:
            colorScheme: "dark",
        }),
    ],

production, or use tracesSampler for greater control.
    tracesSampleRate: 1,

while
    replaysSessionSampleRate: 1.0,
    replaysOnErrorSampleRate: 1.0,
    debug: false,
});

screenshot for at 164.1b37e5fe1265aae3.js:1:21471 in dev tools sources

Trying to deploy a nextjs website with Sentry monitoring on hostinger. Sentry works when running locally, and the site doesnt crash, but it errors out and crashes when deployed on hostinger: console error screenshot

512-fd82f752a414c660.js:525 TypeError: Cannot read properties of undefined (reading 'sentry')
    at 164.1b37e5fe1265aae3.js:1:21471
    at Array.reduce (<anonymous>)
    at q (164.1b37e5fe1265aae3.js:1:21456)
    at n (164.1b37e5fe1265aae3.js:1:34922)
    at 164.1b37e5fe1265aae3.js:17:64552
    at oO (164.1b37e5fe1265aae3.js:17:67668)
    at oA (164.1b37e5fe1265aae3.js:17:63598)
    at 164.1b37e5fe1265aae3.js:17:63405
    at oP (164.1b37e5fe1265aae3.js:17:63412)
    at ov (164.1b37e5fe1265aae3.js:17:60278)
    at og (164.1b37e5fe1265aae3.js:17:58850)
    at S (164.1b37e5fe1265aae3.js:25:1364)
    at MessagePort.T (164.1b37e5fe1265aae3.js:25:1894)

nowhere in my code is .sentry called on any object. This is what my sentry.client.config.ts looks like


Sentry.init({
    dsn: "https://c14ecceb9e4b2cb37fcf625c50cb91db@o4508458061332480.ingest.us.sentry.io/4508458063233024",

    integrations: [
        Sentry.replayIntegration(),
        Sentry.feedbackIntegration({
            // Additional SDK configuration goes in here, for example:
            colorScheme: "dark",
        }),
    ],

production, or use tracesSampler for greater control.
    tracesSampleRate: 1,

while
    replaysSessionSampleRate: 1.0,
    replaysOnErrorSampleRate: 1.0,
    debug: false,
});

screenshot for at 164.1b37e5fe1265aae3.js:1:21471 in dev tools sources

Share Improve this question edited Mar 17 at 7:56 Toasty asked Mar 17 at 7:22 ToastyToasty 32 bronze badges 4
  • Please provide enough information for us to help you debugging. Simply search for .sentry in your source code and past the result here. For example, if you find obj.sentry in your code, this error is caused by the variable obj being undefined. – Gusi Gao Commented Mar 17 at 7:32
  • I've done that and there is nowhere in my code where .sentry is accessed on anything. – Toasty Commented Mar 17 at 7:37
  • Can you use the debugging tool in the browser to figure out the calling stack when this exception is thrown (at at 164.1b37e5fe1265aae3.js:1:21471)? – Gusi Gao Commented Mar 17 at 7:45
  • yes I've added a screenshot – Toasty Commented Mar 17 at 7:56
Add a comment  | 

1 Answer 1

Reset to default 0

This is potentially caused by the reactComponentAnnotation option of the Sentry SDK in your next.config.js. It appends properties to components and if the properties are iterated either by a library or your own code it may sometimes lead to errors.

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论