-
Notifications
You must be signed in to change notification settings - Fork 223
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
could not capture stack trace for span #588
Comments
Thanks for reporting. Can I get you to search through all your dependencies (and sub-dependencies etc) for where |
Thanks for the quick response. const orginal = Error.prepareStackTrace
const overwrites = []
Object.defineProperty(Error, 'prepareStackTrace', {
set: (v) => {
overwrites.push(v)
console.error()
console.error('prepareStackTrace set at')
console.trace()
console.error()
},
get() {
return overwrites[0] // igonre all but the first assignment of prepareStackTrace
}
})
const apm = require('elastic-apm-node').start() With all that instumentation and environment variable
By using the defineProperty trick i prevent prepareStackTrace from being overwritten. Now that prepareStackTrace is set correctly however stackman failes and causes the app to exit. Do you have an idea if stackman works with webpack? |
It should - or at least it shouldn't crash - worst case it should just give up on collecting the stack trace and your app should continue as normal. But you might have discovered a bug. I'll see if I can reproduce it. Do you happen to have a stack trace handy so I can see where it fails?
It's not body-parser or express that are overwriting The dept module uses After I read the source code of dept, it seems like it's doing it in a way that's not in conflict with stackman. I.e. it's only overwriting |
sorry for the delay - was on vacation |
I did not investigate further since we encountered #398 in production and disabled the capturing of stack traces altogether. (i'll post details on that issue) I consider this issue solved since i could get the capturing of stack traces to work by ensuring prepareStackTrace is not overwritten by any other package. Stackman failing to capture the surrounding lines is technically a different issue for which i'd open a separate issue in case in case #398 gets solved and the issue remains. Thanks for the quick support. |
This is likely not a bug - rather i am probbably missing something:
APM is working except that my spans don't have any stacktraces.
In my node app i get messages like this for every single span:
So far i stopped using
import 'source-map-support/register'
to not alter prepareStackTrace as reccomended in https://discuss.elastic.co/t/node-agent-could-not-capture-stack-trace-for-span/130775. Doing this however did not help.My node app uses typescript and webpack.
node: v8.9.4
webpack: 3.11.0
typscript: 3.0.1 and emits es2018 code.
babel is not used and i boostrap via
const apm = require('elastic-apm-node').start()
with env varsWebpack emits my server.js along with server.js.map and the server.js correctly references the source map like
//# sourceMappingURL=server.js.map
like it said it needs to in https://www.elastic.co/guide/en/apm/agent/nodejs/current/source-maps.html and i never had issues with source maps during debugging.Can you help me to get rid of the error messages and get the spans to work correctly?
The text was updated successfully, but these errors were encountered: