Stack traces as an array of stack frames with source maps support.
import {
getStackTrace,
serializeStackTrace,
} from 'get-stack-trace';
const stackTrace = getStackTrace();
serializeStackTrace('Error', 'Hello, World!', stackTrace);
Stack traces as an array of stack frames with source maps support.
License: Other
TL;DR: Is there a reason for not caching fs.accessSync
results during source map resolution? And original line number results from SourceMapConsumer
?
Considering get-stack-trace
is used by slonik
every time an SQL query is made this library attempts to read the source files associated with the call and if they don't exist it will still attempt to read them next call anyway π€― .
Recently my team has tracked down a large amount of memory use being attributed to DataDog/dd-trace-js#913 (comment)
Digging deeper, it appears the cause is due to dd-tracer
keeping track of all file reads, and because get-stack-trace
is constantly trying to read files which don't exist DD is tracking these metrics and filling memory whilst it waits to send the metrics off. When we disabled the DD fs plugin our memory usage dropped significantly during intensive database tasks.
I can see a few improvements which could be made to solve these issues and improve performance of this library:
isReadable
: https://github.com/gajus/get-stack-trace/blob/master/src/resolveCallSiteSourceCodeLocation.js#L36SourceMapConsumer
: https://github.com/gajus/get-stack-trace/blob/master/src/resolveCallSiteSourceCodeLocation.js#L39The results of both of these processes should remain static throughout execution, as we don't expect source files to change during execution.
I'm happy to put in a PR to make these improvements.
Further details of what our memory ends up being filled with because of this:
main
branch failed. π¨I recommend you give this issue a high priority, so other packages depending on you can benefit from your bug fixes and new features again.
You can find below the list of errors reported by semantic-release. Each one of them has to be resolved in order to automatically publish your package. Iβm sure you can fix this πͺ.
Errors are usually caused by a misconfiguration or an authentication problem. With each error reported below you will find explanation and guidance to help you to resolve it.
Once all the errors are resolved, semantic-release will release your package the next time you push a commit to the main
branch. You can also manually restart the failed CI job that runs semantic-release.
If you are not sure how to resolve this, here are some links that can help you:
If those donβt help, or if this issue is reporting something you think isnβt right, you can always ask the humans behind semantic-release.
An npm token must be created and set in the NPM_TOKEN
environment variable on your CI environment.
Please make sure to create an npm token and to set it in the NPM_TOKEN
environment variable on your CI environment. The token must allow to publish to the registry https://registry.npmjs.org/
.
Good luck with your project β¨
Your semantic-release bot π¦π
My goal is to catch error and modify it so re-thrown shows correct stacktrace, is it possible with this library? Something like:
try {
// code
} catch (err) {
throw getOriginalError(err)
}
I am using slonik as a postgres-client to talk to my database. It is being used in 2 places -
In the first scenario, I get an error message - ENOENT: no such file or directory, open '<PATH TO>/.esbuild/.build/src/handlers/mappings.wasm'
. Which suggests that it is looking for that file in order to capture stack trace.
esbuild config in serverless -
esbuild:
loader:
.graphql: text
.html: text
packager: npm
bundle: true
minify: true
sourcemap: true
keepNames: true
concurrency: 8
exclude:
- pg-native
also the order for plugins in correct in serverless
In the second scenario, it works like a charm. I am able to talk to my db and also get the stack trace which is super helpful.
Not sure about the possible solution but I can temporarily disable slonik to capture stack trace by setting captureStackTrace: false
while creating pool.
Unable to produce a details log because captureStackTrace
itself is throwing error.
Hey @gajus came across this repo reading your comments on stack-trace.
We've recently been building out an experimental API for source-maps in Node.js itself. It's my goal to find some of the foundational libraries in the community that use prepareStackTrace
, with the goal of potentially wiring in Node.js' built in source-map cache.
On my mind is stack-trace, express, winston, and bunyan.
Have any thoughts regarding a good approach ... I'm thinking if we could get some of your work in get-stack-trace
upstreamed to stack-trace
, it would help us support Winston.
Given your knowledge in the space, I'd also love your thoughts on how we'd add support to express (which overrides prepareStackTrace
in depd
), without stepping on the toes of bunyan/winston.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.