-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Closed
Description
Do you want to request a feature or report a bug?
feature
(If this is a usage question, please do not post it here—post it on forum.sentry.io instead. If this is not a “feature” or a “bug”, or the phrase “How do I...?” applies, then it's probably a usage question.)
What is the expected behavior?
According to the sentry docs,
In Python and PHP, Sentry will display the values of local variables at the time of each error.
Why don't we have this in js as well, and preferably also in react native? I think with the arguments
variable we could log at least the locals of the function generating the exception, which would still be immensely useful.
AndreMiras, chadwhitacre and raphaelmerx
Activity
benvinegar commentedon Jul 21, 2017
Unfortunately this isn't possible today in browser JavaScript. The
arguments
object is lost by the time execution enterstry/catch
or theonerror
global error handler.We've long experimented with making this possible, but short of re-writing your code during a compilation step to expose every conceivable variable to Raven.js (e.g. using a babel plugin) – which would make all but trivial applications pretty much unusable – there's not much we can do.
n-peugnet commentedon Jun 27, 2019
And what about Nodejs ? Would it be possible ?
benvinegar commentedon Jun 27, 2019
You're welcome to give it a shot – pull requests are accepted!
I've heard that it may be possible to run V8 in some kind of debugging/development mode that could expose local variables, if you wanted to start there.
AbhiPrasad commentedon Jan 16, 2023
it's been a while since we started this convo, but we finally have support for stack locals in NodeJS. If you upgrade
@sentry/node
to7.32.0
or above, you can use theLocalVariables
integration to make this work.This only works for NodeJS on v8 - not supported for other JS runtimes (yet).
AbhiPrasad commentedon Feb 6, 2023
Hey! We also released a blog post detailing how this works under the hood if anyone is curious: https://blog.sentry.io/2023/02/01/local-variables-for-nodejs-in-sentry/
jackkinsella commentedon Apr 24, 2024
@AbhiPrasad Are there any plans to port this over to browser JavaScript? I can imagine this would be a huge hit.
AbhiPrasad commentedon Apr 24, 2024
Hey @jackkinsella unfortunately there is no way for us to access this information in the browser - we would love to support it if we could!