Could you include the src files in packages like @mastra/core?
When implementing applications using mastra, we've encountered issues that aren't actually with our application but with the core mastra library itself. On several occasions, we've spent significant time debugging issues in mastra itself.
I believe including source files and properly distributing sourcemaps would make debugging much easier. While this would increase the npm install time.
What are your thoughts on this?
9 Replies
Currently, we're writing .pnpmfile.cjs files like this and referencing locally cloned mastra for debugging purposes.
Hello!
We're distributing source maps, you can see them here for example: https://app.unpkg.com/@mastra/core@0.24.6/files/dist
Is that not working for you?
UNPKG
The CDN for everything on npm
Including the
src is not an option since that would dramatically increase the size and we need to be conscious of that for targets like serverless functions that have size limitsHi, just having a source maps doesn't allow you to set breakpoints and directly debug your typescript files.
@kosukeoya sorry we wont' add src files, it makes the install larger and we rather do not. sourcemaps should do enough. What are you missing here?
I want to be able to jump to code locations in typescript files.
I frequently need to examine implementations this way, but when I navigate to minified code, I can't understand how the functions actually behave. (Moreover, I can't set breakpoints or inspect variables by inserting debugger statements.)
The restriction on including source files makes sense, but how should I debug when I suspect an issue with mastra? Please share any good methods you know of.
š Created GitHub issue: https://github.com/mastra-ai/mastra/issues/10617
š If you're experiencing an error, please provide a minimal reproducible example whenever possible to help us resolve it quickly.
š Thank you for helping us improve Mastra!
š Created GitHub issue: https://github.com/mastra-ai/mastra/issues/10618
š If you're experiencing an error, please provide a minimal reproducible example whenever possible to help us resolve it quickly.
š Thank you for helping us improve Mastra!
I frequently need to examine implementations this way, but when I navigate to minified code, I can't understand how the functions actually behave. (Moreover, I can't set breakpoints or inspect variables by inserting debugger statements.)We don't minify the code (if I remember correctly) so the code itself is close if not the same as the TS source just without the TS annotations. It doesn't follow the file structure but you can jump around the chunks to find what you're looking for. Adding breakpoints/debugger in
node_modules works generally speaking, maybe you're invoking mastra command incorrectly and it's not triggering the debugger statements?https://app.unpkg.com/@mastra/core@0.24.6/files/dist/chunk-LAQQETGP.js
This is a file where the Agent class is implemented, but is it not minified?
Indeed, until now I would set breakpoints in the bundled js files, inspect them, and then step through the relevant functions in the TypeScript code for debugging.
Since we started minifying this has become much harder.