<unlabeled event> when reporting error from embedded webview

Hello! I’m working on adding Sentry monitoring for JS errors that occur in a webview embedded in a native (Android) application. Some errors are being reported correctly (with proper stacktraces via uploaded sourcemaps), but I’m having issues with a few classes of errors.

For one, errors that arise from JS evaluation that’s triggered from the native side (via evaluateJavascript) are being reported as <unlabeled event> in the Sentry UI. I’m wrapping the executed JS in Raven.context. Here’s the request payload (the request itself 200s):

As I mentioned, in the dashboard, the error appears as <unlabeled event> in bundle-webpack.js, with a big red dot.

More than happy to provide more info, if it’d be useful. Sentry is going to be lifesaving for us, as we’ve been losing stack traces when reporting JS exceptions via our native error monitoring tools!

Hey there,

Could you paste a (redacted version of) the JSON payload of the event as it exists in Sentry? You can find a link to this next to the event title (e.g. Event abcdef123456) inside the Sentry UI.

Off the top of my head, what you’ve pasted looks correct. <unlabeled event> is odd to me because (unless I’m mistaken) that string appears if we can not gleam an event message from the exception, but there’s clearly an exception type/value.

Sure thing – thanks for the quick response.

{"id":"d76f21a97ef44580b4d660c4e9b2269c","project":120139,"release":"394","platform":"javascript","culprit":"bundle-webpack.js","message":"<unlabeled event> bundle-webpack.js","datetime":"2016-12-08T16:19:40.000000Z","time_spent":null,"tags":[["level","error"],["logger","javascript"],["sentry:release","394"],["environment","debug"],["transaction","bundle-webpack.js"],["url","file:///android_asset/webview/templates/exercise-view.html"],["sentry:user","ip:xx.xxx.xxx.xx"],["device","Smartphone"],["device.family","Generic Smartphone"],["os.name","Android"]],"contexts":{"device":{"model":"Smartphone","brand":"Generic","family":"Generic Smartphone"},"os":{"version":null,"name":"Android"}},"errors":[],"extra":{"session:duration":633997},"fingerprint":["{{ default }}"],"metadata":{"title":"<unlabeled event>"},"received":1481213980.0,"sdk":{"client_ip":"xx.xxx.xxx.xx","version":"3.9.1","name":"raven-js"},"sentry.interfaces.Breadcrumbs":{"values":[{"category":"xhr","timestamp":1481213345.185,"type":"http","data":{"url":"../javascript/perseus-package/config.json","status_code":"200","method":"GET"}},{"category":"console","timestamp":1481213346.142,"message":"JQMIGRATE: Logging is active","type":"default","level":"log"}]},"sentry.interfaces.Http":{"url":"file:///android_asset/webview/templates/exercise-view.html","headers":[["User-Agent","{\"appId\":\"org.khanacademy.android.debug\",\"os\":\"Android\",\"deviceName\":\"Android SDK built for x86_64\",\"deviceBrand\":\"Android\",\"appVersion\":\"2.4.2\",\"buildNumber\":394,\"deviceType\":\"phone\",\"androidApiLevel\":24,\"deviceYearClass\":2012,\"acceptEncoding\":\"gzip\"}"]],"query_string":"platform=android&customKeypadEnabled=1&lang=en_US&perseusStaticFileUrlBase=https%3A%2F%2Fwww.zero.khanacademy.org%2Fapi%2Finternal%2Fios%2Fstatic_redirect%2F&sentryRelease=394&sentryEnvironment=debug"},"sentry.interfaces.User":{"ip_address":"xx.xxx.xxx.xx"},"type":"default","version":"7"}

Not sure if this is relevant, but here’s my Raven setup (the normalize thing was taken from the linked Gist, and seems to have worked in other cases where errors are reporting as usual):

Raven.config(
    configUrl,
    {
        release: window.EnvironmentUtils.sentryRelease,
        environment: window.EnvironmentUtils.sentryEnvironment,
        dataCallback: function(data) {
            // Normalize our stacktraces by replacing the filepath to our
            // bundle on-disk with a relative path from the /build/
            // directory. This ensures that our traces are consistent
            // across platforms.
            // See: https://gist.github.com/danharper/a89685cc1028759345b8.
            var normalize = function(filename) {
                return filename.split('/build/', 2)[1];
            };

            var frames = data.exception.values[0].stacktrace.frames;
            for (var i = 0; i < frames.length; i++) {
                var frame = frames[i];
                frame.filename = normalize(frame.filename);
            }

            data.culprit = data.exception.values[0].stacktrace.frames[0].filename;

            return data
        },
    }
).install();

Hey, just a heads up. Still looking into this, just haven’t figured it out quite yet.