DataDog/browser-sdk

๐Ÿ™ [NEXTJS] Unable to use RUM without error

paul-roman opened this issue ยท 1 comments

What are you trying to achieve and what is your issue? Please describe.
I used the official doc to install RUM on my Next.js application, and it's working like a charm on a dev environment.
However, whenever the code goes to staging/production I run into an error: datadogRum.init seems to be working just fine, as well as setUser, however when I turn debug on using ._setDebug(true), I get an error whenever I load a page or whenever I try to .startView manually:
Image

This error seems to come from this line in the RUM source code (browser-sdk/packages/core/src/domain/session/sessionManager.ts) :

function buildSessionContext() {
    return {
      id: sessionStore.getSession().id!, // <------ HERE
      trackingType: sessionStore.getSession()[productKey] as TrackingType,
      isReplayForced: !!sessionStore.getSession().forcedReplay,
    }
  }

I use the 5.28.0 version.
Does anyone has any clue about this? ๐Ÿ™

Hello @paul-roman,
Sry for the delay. I can't reproduce the issue locally.
Can you provide a minimal reproductible example?