Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding the Javascript frames to the crash reports’ stack trace. #2

Closed
shercoder opened this issue Dec 30, 2016 · 13 comments
Closed
Assignees

Comments

@shercoder
Copy link

Currently, the stacktrace we get is useless when trying to track the problem in Javascript. It makes it difficult to reproduce the problem and harder to fix when we don't have Javascript stacktrace.

Are there are any plans to support this in near future?

Currently I am trying to get the following solution working which I took from https://github.com/mikelambert/react-native-fabric-crashlytics and modified a bit to use with Instabug. But this isn't much helpful either since the stacktraces still come from the bundle file and it's useless. I am currently looking into adding sourcemap and see if that would be helpful. However, if this can supported out of the box in instabug-reactnative then that would be very helpful for Instabug users.

'use strict';

import { Platform } from 'react-native';
import StackTrace from 'stacktrace-js';
import Instabug from 'Instabug';

function init() {
	// if (__DEV__) {
	// 	// Don't send exceptions from __DEV__, it's way too noisy!
	// 	// Live reloading and hot reloading in particular lead to tons of noise...
	// 	return;
	// }

	const originalHandler = global.ErrorUtils.getGlobalHandler();
	function errorHandler(e, isFatal) {
		StackTrace.fromError(e, {offline: true}).then((x) => {
			const result = x.map((row) => {
				return `functionName: ${row.functionName}\nsource: ${row.source}\nfileName:${row.fileName}:${row.lineNumber || 0}:${row.columnNumber || 0}\n`;
			});
                        Instabug.log(result.join('\n'));
			Instabug.reportException(e.message);
		});
		// And then re-throw the exception with the original handler
		if (originalHandler) {
			if (Platform.OS === 'ios') {
				originalHandler(e, isFatal);
			} else {
				// On Android, throwing the original exception immediately results in the
				// recordCustomExceptionName() not finishing before the app crashes and therefore not logged
				// Add a delay to give it time to log the custom JS exception before crashing the app.
				// The user facing effect of this delay is that separate JS errors will appear as separate
				// issues in the Crashlytics dashboard.
				setTimeout(() => {
					originalHandler(e, isFatal);
				}, 500);
			}
		}
	}
	global.ErrorUtils.setGlobalHandler(errorHandler);
}

module.exports = {
	init,
};
@yousefhamza
Copy link
Contributor

Thanks for your feedback we highly appreciate it, We have looked into it and will consider it for future development.

@jozan
Copy link
Contributor

jozan commented Apr 7, 2017

JS stacktrace is quite important for us as well. I would like to see them in the future releases!

@salmatarzi
Copy link
Contributor

@jozan @shercoder I know this issue has been here for a long time, and I really apologise for that. Update: We are currently working on supporting JS stacktraces, and hopefully it will be released by the end of September.

@SudoPlz
Copy link

SudoPlz commented Aug 15, 2017

That's the only reason I'm also using BugSnag right now.
If you guys implement javascript stack trace (w/ deobfuscation) I'd definitely prefer using your tool for bugs.

@NadineMansour NadineMansour changed the title Any plans to support ReactNative exception stacktrace? Adding the Javascript frames to the crash reports’ stack trace. Aug 22, 2017
@NadineMansour
Copy link

@shercoder I renamed the issue to help other people identify the topic more quickly.

@jozan
Copy link
Contributor

jozan commented Oct 18, 2017

@salmatarzi Hello! Do you know is the support for JS stacktraces still on your priority list?

@salmatarzi
Copy link
Contributor

@jozan Hey! Yes, it's on the top of our priority list. It's what we're currently working on right now. I will update you when it gets released.

@jozan
Copy link
Contributor

jozan commented Oct 18, 2017 via email

salmatarzi added a commit that referenced this issue Feb 28, 2018
@RWOverdijk
Copy link

I can 👍 this. Bugsnag does this beautifully. You can even upload a source map to get readable stacktraces! Of course, it doesn't have the awesome feedback feature.

@salmatarzi
Copy link
Contributor

@RWOverdijk @jozan @SudoPlz @shercoder JS stack traces is now supported on version 2.11.0 ✨🎉

@RWOverdijk
Copy link

@salmatarzi Cool! Blog post?

@SudoPlz
Copy link

SudoPlz commented May 7, 2018

  • Also does it work for both iOS and Android?
  • And do we have to upload sourcemaps somehow?

@lock
Copy link

lock bot commented May 19, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators May 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants