Private Source Maps with Monti APM

Support for private source maps was added this week to Monti APM. Since this was custom built for Meteor apps, the set up is much simpler.

  1. Add/update the agent
  2. Replace the default js minifier with one that creates production source maps
  3. Make the source maps private
meteor add montiapm:agent
meteor remove standard-minifier-js
meteor add zodern:standard-minifier-js
meteor add zodern:hide-production-sourcemaps

There are no versions to configure or scripts to write.

The source maps are uploaded as needed for new errors, and cached by Monti APM for up to two weeks. The feature is enabled by default in production when using a minifier that creates source maps.

More information is available in the docs.


Version 3 of zodern:standard-minifier-js is also available. The main change is that now Meteor decides the file names. This removes any potential caching problems caused by always using app.js.

10 Likes

Well done @zodern :clap: We’ll be trying that out today :slight_smile:

1 Like

Wow looking forward to try this out!

This feature was something we were missing from meteor core for a long-time. Thanks for working this out!

Excellent!

Trying this out now (after many, many hours spent over many weeks trying to get Sentry working with Meteor - don’t judge me!) - https://github.com/meteor/meteor-feature-requests/issues/30

Just looking through some client errors in our app from over the weekend. Full sourcemaps make it so much easier :sunglasses: :tada:

1 Like

Hmm, I must be doing something wrong (tried this out and added it yesterday as a test) - here is a screenshot of a client-side error I am getting:

I wonder whether that is a mis-step on my end or whether sourcemaps don’t cover the entire code base

Thanks for trying it @hemalr87.

The last frame (XMLHttpRequest.d) was in a script loaded from a CDN, which Monti APM currently does not check for source maps (I am planning to add this).

The rest of the stack trace looks correct. It shows the package and original file names. For comparison, here is a stack trace before and after applying source maps:

    at e.<anonymous> (https://app.montiapm.com/6a645a58f1a7ae7d2668d32138327c290deb6373.js?meteor_js_resource=true:279:27934)
    at Object.e._runFlush (https://app.montiapm.com/6a645a58f1a7ae7d2668d32138327c290deb6373.js?meteor_js_resource=true:29:3832)
    at e (https://app.montiapm.com/6a645a58f1a7ae7d2668d32138327c290deb6373.js?meteor_js_resource=true:3:2174)
    at render (meteor://💻app/client/components/0common/react/component.js:13:10)
    at func (meteor://💻app/packages/tracker.js:548:10)
    at index (meteor://💻app/packages/meteor.js:448:16)

INVALID_STATE_ERR is included in the filterCommonMeteorErrors error filter, which Kadira’s docs had said filtered out errors that can not be prevented.

Please let me know if you have any further questions.