sentry-react-native icon indicating copy to clipboard operation
sentry-react-native copied to clipboard

Use of undeclared identifier 'SentryLog'" on every SENTRY_LOG_DEBUG statement.

Open ohheyitskartik opened this issue 1 year ago • 1 comments

OS:

  • [x] MacOS

Platform:

  • [x] iOS (only tried on ios for now)

SDK:

  • [x] @sentry/react-native (>= 6.0.0)

SDK version: 6.0.0

react-native version: 0.75.2

Are you using Expo?

  • [x] Yes (integrated over bare react native)

Are you using sentry.io or on-premise?

  • [x] sentry.io (SaaS)

Configuration:

(@sentry/react-native)

Sentry.init({
    dsn: mainConfig.SENTRY_DSN_KEY,
    tracesSampleRate: 0.3,
    autoSessionTracking: true,
    sessionTrackingIntervalMillis: 1000,
    enableNative: isProd,
    integrations: [
        new Sentry.ReactNativeTracing({
            tracingOrigins: ['localhost', /^\//],
            routingInstrumentation,
            beforeNavigate: context => {
                context.name = context.name.toUpperCase();
                context.tags = {
                    ...context.tags,
                    customTag: 'value',
                };

                return context;
            },
        }),
    ],
    beforeSend: event => {
        try {
            if (MMKV?.getBool(asyncStorageConstants.ELKLOG_SENTRY)) {
                elkLogger.error(event);
            }

            const exceptions =
                event?.exception?.values?.filter(item => !item?.mechanism.handled) || [];

            if (!!exceptions && exceptions?.length) {
                return {
                    ...event,
                    exception: {
                        values: exceptions,
                    },
                };
            }
            return null;
        } catch (err) {
            elkLogger.error(err);
        }
        return null;
    },
    environment: mainConfig.ENV,
});

I have the following issue:

Facing "/ios/Pods/Sentry/Sources/Sentry/Profiling/SentryProfilerSerialization.mm:331:9 Use of undeclared identifier 'SentryLog'" on every SENTRY_LOG_DEBUG statement.

Steps to reproduce:

  • install on above stated react native version
  • build on xcode 16.

Actual result:

Build failure for - "/ios/Pods/Sentry/Sources/Sentry/Profiling/SentryProfilerSerialization.mm:331:9 Use of undeclared identifier 'SentryLog'" on every SENTRY_LOG_DEBUG statement.

Expected result:

No build Errors.

ohheyitskartik avatar Oct 07 '24 07:10 ohheyitskartik

Hi @ohheyitskartik, thank you for the message,

do you or any of the code executed during your application pod install change APPLICATION_EXTENSION_API_ONLY build setting?


Sentry Cocoapod requires APPLICATION_EXTENSION_API_ONLY=YES, it's possible that some other library changed this setting. Please, try to add the following code to your pod file.

post_install do |installer|
  react_native_post_install(
    installer,
    config[:reactNativePath],
    :mac_catalyst_enabled => false,
  )

  # Add this
  installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      if target.name == 'Sentry'
        config.build_settings['APPLICATION_EXTENSION_API_ONLY'] = 'YES'
      else
        # configuration for other targets
      end
    end
  end
end

Related issues:

  • https://github.com/getsentry/sentry-cocoa/issues/4339
  • https://github.com/getsentry/sentry-react-native/issues/4095

krystofwoldrich avatar Oct 07 '24 09:10 krystofwoldrich

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 remove the label Waiting for: Community, I will leave it alone ... forever!


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

getsantry[bot] avatar Oct 29 '24 07:10 getsantry[bot]

Closing this due to inactivity. If this is still an issue feel free to comment here or open a new issue if the context changed.

krystofwoldrich avatar Oct 29 '24 13:10 krystofwoldrich