-
Hi there, I'm trying to set up Sentry on my Next v14/App router. I've got it correctly logging errors to my Sentry installation, but I'm trying to add some user identifiers to the errors, so I can reference them to users in my DB. I have used this successfully in the past on my
This worked on the Pages router, but it seems in App router (with RSC and all that) it doesn't work, and add the user to the error? I have done a request to get the userId in my Layout RSC, and trying to attach it to the RootLayout at
But it doesn't seem to carry through this id to the error that's logged within Sentry. Is it because of server components somehow, and how they are now different to client components? Just trying to get my head around this, and how to keep the code clean - and how best to tackle this for errors within both server and client components! Thanks! |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 3 replies
-
flows is a client component, so it have the user context. |
Beta Was this translation helpful? Give feedback.
-
To add to my comment here: #10019 (reply in thread) Server and client components are also separated logically. Meaning that when you call |
Beta Was this translation helpful? Give feedback.
-
Thanks |
Beta Was this translation helpful? Give feedback.
To add to my comment here: #10019 (reply in thread)
Server and client components are also separated logically. Meaning that when you call
setUser()
on the server, it is not propagated to the client. On the client you would also have to call the method.