Open DanielSRS opened 1 month ago
The transport is intentionally very simple, accepting only strings, because Crashlytics is used in production, where the stack trace would be incomprehensible anyway due to the JS bundle. JavaScript source maps would need to be sent to Crashlytics, but I’m not sure if that’s currently possible…
Sorry, I think I didn't organized the info in this issue the best way. The important part is kinda hidden.
The problem is not the stack trace, but string only logs not being sent at all to crashlytcs.
When using this transport, I immediately got warnings from the firebase lib informing that those reports were going to be ignored because they're not Error instances.
I realize now that I should've investigated a little more. I started the integration with crashlytcs in my app and reported this as soon as I noticed, but collecting more data about the actual behavior would be better.
In short, what I noticed:
Since these logs/reports can take some time to be processed by crashlytcs. I think the period of my observations were too short, and so, they can be wrong.
I just ran into this as well, what I did was this, the comment points out the issue that was noticed:
logger.createLogger({
transport: [ crashlyticsTransport ],
transportOptions: {
CRASHLYTICS: {
recordError(msg) {
// firebase/crashlytics expects an instance of error here
// however, react-native-logs expects msg to be type string
crashlyticsModule.recordError(new Error(msg));
}
}
}
})
Any thoughts on supporting the latest signature of recordError
? https://github.com/invertase/react-native-firebase/blob/main/packages/crashlytics/lib/index.js#L118-L128 Though I'd imagine it would be a breaking change you may not be interested in bringing in
When I use it, I get this warning:
firebase.crashlytics().recordError(*) expects an instance of Error. Non Errors will be ignored.
Checking the implementation I noticed that props.msg is being passed down to recordError, but props.msg besides being typed as any is
aways a string
As a quick workaround I wrapped errors in an Error:
but this is a bad alternative and customTransport ends up being reported as the source of the error.
Maybe a better approach would be to:
but thats is just an suggestion and maybe not the best solution