Clojurescript, sourcemaps

Hi guys!

I’m having trouble getting sentry to work with clojurescript source maps and I’m looking for suggestions.

I have an app that’s split into two parts: a small js app compiled with webpack, and a larger cljs app compiled with closure. After uploading the sources and sourcemaps as described here for both js and cljs, the mapping only seems to work with the js.

When I look at the sentry UI stacktrace, it will show lines such as called from /main.out/foo/bar.cljs. However, at the top of the error report will be a big orange box reading "There were X errors encounters while processing this event".

Each error is listed as an HTTP returned 404 response on: https://redacted/main.out/foo/bar.cljs.

I’m not sure the root of my misunderstanding. I thought closure advanced=true compiled all sources into a single main.js file. Yet source maps (locally, at least) only seem to work if the main.out/ file is in the same relative root as the generated main.js file. I suppose this makes sense because the sourcemap declaration looks something like sources: ["main.out/foo/bar.js"]. What is unclear is whether or not this main.out/foo/bar.js now has to be incuded as a pre-uploaded file for sourcemaps to work?

I’m wondering if anyone can shed some light on this topic? Hopefully someone else has used sentry and cljs and can point me in the right direction.

While not familiar with Clojurescript, we just follow the implementation specs of Sourcemaps. That is, we look for a header or an annotation which points to the mapping file. Once we find the mapping file, we then look for the individual source, which may either be bundled into the map (via sourceContent) or reference to external files. If they’re external we’ll fetch them using the same approach as any other JS artifact (releases -> scraper).

@lwarton – so, you have two choices:

  1. Upload all your original source files to Sentry (as artifacts)

or

  1. Find a way to get the ClojureScript compiler to generate source maps with your source files embedded inside. This means that your original source files are available inside your source map file via the sourcesContent property. This is the preferred method, and we provide instructions on how to do this with Webpack, Uglify, SystemJS, etc.

Thanks for the quick response gents. It seems like the closure compiler doesn’t implement sourcesContent. Since I’m quite tired of working on ops and don’t feel like writing more glue to inline them myself, I guess I’ll resort to whitelisting your IPs and exposing maps that way.

**
Also, congrats on the new release. Just noticed a few minutes ago.