getsentry / sentry-react-native

Official Sentry SDK for React Native
https://sentry.io
MIT License
1.57k stars 337 forks source link

'Sentry/SentryTraceContext.h' file not found #2353

Closed rafaelmaeuer closed 2 years ago

rafaelmaeuer commented 2 years ago

Build of React Native App fails after upgrading sentry-react-native to v4.x.x.

react-native-firebase > v15 requires use_frameworks! in podfile: https://github.com/invertase/react-native-firebase/blob/main/CHANGELOG.md#breaking-changes

Seems like sentry-react-native has problems handling dynamic libraries in v4. There is an open PR on sentry-cocoa for this: https://github.com/getsentry/sentry-cocoa/pull/1726

Environment

How do you use Sentry?

Which SDK and version?

Steps to Reproduce

  1. Add use_frameworks! to podfile
  2. Try to build React Native App

Expected Result

Build should complete.

Actual Result

Error: 'Sentry/SentryTraceContext.h' file not found in 'Development Pods/RNSentry/RNSentry.m'

image

For now this requires to hold back either sentry-react-native < v4 or react-native-firebase < v15

marandaneto commented 2 years ago

@rafaelmaeuer you've likely have an outdated pod, try to:

cd ios pod update pod install

does it help?

s5z6 commented 2 years ago

Same issue

hatem-72 commented 2 years ago

I can confirm that running a project on IOS using both sentry-react-native and use_frameworks! fails with

▸ Compiling RNSentry.m

❌  /path-to-my-project/node_modules/@sentry/react-native/ios/RNSentry.m:11:9: 'Sentry/SentryTraceContext.h' file not found

#import <Sentry/SentryTraceContext.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
rafaelmaeuer commented 2 years ago

@rafaelmaeuer you've likely have an outdated pod, try to:

cd ios pod update pod install

does it help?

Nope I did this several times while figuring out this error...

marandaneto commented 2 years ago

@rafaelmaeuer you've likely have an outdated pod, try to:

cd ios pod update pod install

does it help?

Nope I did this several times while figuring out this error...

@rafaelmaeuer I've created an empty project (template) and everything worked out, so I can't reproduce this issue, since this class was added in the latest versions of the iOS SDK, seems like a cached pod issue. Try to remove the pod lock file and the node_nodules and yarn/npn install again, pod install as well, if that does not work. Can you provide a minimal reproduction example?

rafaelmaeuer commented 2 years ago

Yes of course:

marandaneto commented 2 years ago

@brustolin or @philipphofmann can you take a look at this? I can't reproduce it but I've not tried with use_frameworks

philipphofmann commented 2 years ago

The RN SDK imports SentryTraceContext, which is not public https://github.com/getsentry/sentry-react-native/blob/736eee2697e95315f1a76fc24e865c4564a5a9a8/ios/RNSentry.m#L11

see https://github.com/getsentry/sentry-cocoa/blob/master/Sources/Sentry/include/SentryTraceContext.h.

@brustolin, did you maybe recently change anything for the SentryTraceContext? Was it public before?

brustolin commented 2 years ago

@philipphofmann Nope, I did not changed its availability. SentryTraceContext was never public.

brustolin commented 2 years ago

So, a quick workaround in order for you to continue using the SDK before we fix it.

@interface SentryTraceContext : NSObject
- (nullable instancetype)initWithDict:(NSDictionary<NSString *, id> *)dictionary;
@end
philipphofmann commented 2 years ago

@brustolin, could you maybe open a PR to fix the code in RNSentry.m, please?