You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
capturing a message with stack trace using @sentry/browser #1666
(which is arguably uglier), but the real problem is that there's no way to add stacktrace: true, instead the stacktrace argument requires an actual stack trace. I tried settings stacktrace: true but I got "Discarded invalid value for parameter 'stacktrace'".
It doesn't seem to be possible to log a message with a stack using @sentry/browser.
(github is still being a pain, so I can't see your message except in
emails.)
That's useful, thank you. Would still be useful to decide whether to
include the stack trace when firing the message.
While attaching a stack seems simple, it actually adds a overhead to performance and payload.
In regards to capturing any extra data with an event, you can do it either by using configureScope or withScope see: https://docs.sentry.io/learn/scopes/?platform=browser
Also if this seems not to be enough you can write your own integration.
This issue appears at the top of a Google search for sentry capturemessage stacktrace.
Since the reference link is Page Not Found, the latest attachStackTrace link is included.
There is an option called attachStacktrace for init
Not ideal as this doesn't let you include for just some messages, and the overhead involved means it's likely undesirable to enable it for all messages.
If you only want it for specific messages, I'd suggest to just use Sentry.captureException(new Error('my message with stack'), { level: 'info' }), or something along these lines.
Activity
HazAT commentedon Oct 22, 2018
There is an option called
attachStacktraceforinitsee: https://docs.sentry.io/learn/configuration/?platform=browser#attach-stacktraceAfter that you call
captureMessageand you will get a stacktrace.samuelcolvin commentedon Oct 22, 2018
HazAT commentedon Oct 22, 2018
While attaching a stack seems simple, it actually adds a overhead to performance and payload.
In regards to capturing any extra data with an event, you can do it either by using
configureScopeorwithScopesee: https://docs.sentry.io/learn/scopes/?platform=browserAlso if this seems not to be enough you can write your own integration.
samuelcolvin commentedon Oct 22, 2018
Thanks for the response, I'll close this however IMHO it still seems like a step back from the raven-js interface.
kajirikajiri commentedon Feb 28, 2023
https://docs.sentry.io/platforms/javascript/configuration/options/#attach-stacktrace
This issue appears at the top of a Google search for sentry capturemessage stacktrace.
Since the reference link is Page Not Found, the latest attachStackTrace link is included.
adrian-skybaker commentedon Apr 30, 2024
Not ideal as this doesn't let you include for just some messages, and the overhead involved means it's likely undesirable to enable it for all messages.
mydea commentedon Apr 30, 2024
If you only want it for specific messages, I'd suggest to just use
Sentry.captureException(new Error('my message with stack'), { level: 'info' }), or something along these lines.