sentry-capacitor icon indicating copy to clipboard operation
sentry-capacitor copied to clipboard

Officially support React

Open jennmueng opened this issue 3 years ago • 11 comments

Add an example app, and fully test all features.

jennmueng avatar Jun 02 '21 12:06 jennmueng

Is this on the roadmap, does it only work with angular right now?

davidemerritt avatar Jul 30 '21 03:07 davidemerritt

@davidemerritt Yep this is a roadmap item. It officially only works with angular, however in theory React should already work just fine and you can pass @sentry/react as the second parameter to this init call not unlike the angular SDK. If you run into any issues you can just initialize the standalone Sentry Capacitor SDK(Use the "Other Frameworks" tab).

jennmueng avatar Jul 30 '21 04:07 jennmueng

I have it working as you described but wondering what will break... Thanks for the update.

davidemerritt avatar Jul 30 '21 05:07 davidemerritt

Works fine in production

import * as Sentry from '@sentry/capacitor'
import { init as sentryReactInit } from '@sentry/react'

Sentry.init({
  dsn: "__DSN__",
}, sentryReactInit)

piotr-cz avatar May 31 '22 08:05 piotr-cz

Currently implementing sentry with @sentry/capacitor and @sentry/vue but having trouble with BrowserTracing How would you initialize BrowserTracing in this situation?

Example of what I have below

import * as Sentry from '@sentry/capacitor'
import * as SentryVue from '@sentry/vue'

Sentry.init({
  app,
  dsn: "__DSN__",
  integrations: [new BrowserTracing()] // <- TS error
}, SentryVue.init)
Screen Shot 2022-06-07 at 5 49 02 PM

MaxWeisen avatar Jun 08 '22 00:06 MaxWeisen

@MaxWeisen Try pinning @sentry/vue to same version as in @sentry/capacitor's peeerDependencies:

npm install --save-exact @sentry/[email protected]

For explaination see https://github.com/getsentry/sentry-javascript/issues/4474#issuecomment-1028292131

piotr-cz avatar Jun 08 '22 08:06 piotr-cz

Yes, for the time being, sentry/capacitor is not compatible with the newer versions of Sentry/vue, react, angular (7.x). An update to the SDK will be done after the conclusion of the following update to React Native: https://github.com/getsentry/sentry-react-native/pull/2250

lucas-zimerman avatar Jun 08 '22 13:06 lucas-zimerman

@MaxWeisen Try pinning @sentry/vue to same version as in @sentry/capacitor's peeerDependencies:

npm install --save-exact @sentry/[email protected]

For explaination see getsentry/sentry-javascript#4474 (comment)

This works. Thank you for posting!

MaxWeisen avatar Jun 08 '22 16:06 MaxWeisen

Any update on this?

davidemerritt avatar Sep 14 '22 09:09 davidemerritt

Any update on this?

Currently the Capacitor SDK is working just fine with React. The next goal with this PR will be to implement a sample app using React and Sentry Capacitor.

lucas-zimerman avatar Sep 15 '22 13:09 lucas-zimerman

This issue has gone three weeks without activity. In another week, I will close it.

But! If you comment or otherwise update it, I will reset the clock, and if you label it Status: Backlog or Status: In Progress, I will leave it alone ... forever!


"A weed is but an unloved flower." ― Ella Wheeler Wilcox 🥀

github-actions[bot] avatar May 31 '23 00:05 github-actions[bot]