question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

delayedCalls is undefined when using lazy: true

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
rchlcommented, Oct 19, 2021

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?

0reactions
adamlachmanncommented, Mar 6, 2022

Same thing happens for me when using nuxt/composition-api. The solution was to use instance of $sentry in context.app not context directly, as that one seem to retain the mocked sentry plugin.

import { useContext } from '@nuxtjs/composition-api'

... // component.setup
const context = useContext()

context.$sentry.captureException(new Error()) // fails
context.app.$sentry.captureException(new Error()) // works properly
Read more comments on GitHub >

github_iconTop Results From Across the Web

Uncaught undefined error when using React.lazy
After looking at my own question, I figured it out looking at the dependencies. My react and react-dom were on different major versions....
Read more >
Values are not populated after Formatter.js Added
... Custom SAPUI5 application. in my app i need to display currency value with USD format. ... r = true; ... lazyRounding !==...
Read more >
Docs | GSAP | gsap.to()
To disable lazy rendering for a particular tween, set lazy: false . In most cases, there's no need to set lazy . To...
Read more >
Lazy Loading in Entity Framework
LazyLoadingEnabled should be true. Navigation property should be defined as public, virtual. Context will NOT do lazy loading if the property is not...
Read more >
React check if element is visible on screen
This is especially true if you're using more than one kind of element. ... you commonly come across requests such as lazy loading...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found