sentry-module: delayedCalls is undefined when using lazy: true

Version

@nuxtjs/sentry: 5.1.3 nuxt: 2.15.8

Sentry configuration

sentry: {
    disabled: process.env.APP_ERROR_REPORTING_ENABLED === 'false',
    lazy: true,
    publishRelease: false,
    config: {
      environment: process.env.VUE_APP_ENVIRONMENT || 'production',
      release: appVersion
    }
  },

Steps to reproduce

Enable lazy mode

What is Expected?

No errors

What is actually happening?

Occasionally I get this error:

image

Ignore the LogRocket mentions, it’s just capturing it.

image

I traced it back to this line: https://github.com/nuxt-community/sentry-module/blob/master/lib/plugin.lazy.js#L48

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 16 (9 by maintainers)

Most upvoted comments

I can’t actually reproduce locally but looking at your minified code:

window.LogRocket.getSessionURL((e=>{
  r.configureScope((t=>{
    t.setExtra('sessionURL', e)
  }))
}))

this is indeed the reason. It’s quite aggressively minified compared to mine:

                         n.$sentry.configureScope((function(e) {
                           e.setExtra('sessionURL', t)
                         }))

You can see that in my case the app.$sentry is not cached into a local variable so everything works. In your case the minified code does something like var r = app.$sentry earlier so it holds to mocked $sentry reference and uses it even after app.$sentry was updated.

Have you modified any of the babel or terser settings in your nuxt config?