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

postPublish not running on android expo SDK 48 #320

Closed
karbone4 opened this issue Feb 20, 2023 · 16 comments
Closed

postPublish not running on android expo SDK 48 #320

karbone4 opened this issue Feb 20, 2023 · 16 comments

Comments

@karbone4
Copy link

karbone4 commented Feb 20, 2023

Summary

postPublish script not running on android with expo SDK 48 → source maps are not upload to sentry

Managed or bare workflow? If you have ios/ or android/ directories in your project, the answer is bare!

managed

What platform(s) does this occur on?

Android

SDK Version (managed workflow only)

48

Environment

expo-env-info 1.0.5 environment info:
System:
OS: macOS 13.2
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.17.1 - ~/.nvm/versions/node/v16.17.1/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v16.17.1/bin/yarn
npm: 9.3.1 - ~/.nvm/versions/node/v16.17.1/bin/npm
Watchman: 2022.11.07.00 - /opt/homebrew/bin/watchman
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
IDEs:
Android Studio: 2021.3 AI-213.7172.25.2113.9014738
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
npmPackages:
expo: ^48.0.1 => 48.0.1
react: 18.2.0 => 18.2.0
react-native: 0.71.2 => 0.71.2
npmGlobalPackages:
eas-cli: 3.6.0
expo-cli: 6.1.0
Expo Workflow: managed

Reproducible demo or steps to reproduce from a blank project

https://github.com/karbone4/sentry-expo-sample-app (empty app with expo sdk 48)

@evelant
Copy link

evelant commented Feb 25, 2023

Also seeing this in my project

@evelant
Copy link

evelant commented Feb 25, 2023

It looks like the Expo documentation may be out of date or the sentry-expo plugin is out of date. The expo docs on migrating from "expo build" say

With EAS Build, the Classic Update's expo publish command is not run as part of the build process. Instead, the JavaScript bundle is generated locally on EAS Build at build time and directly embedded in the app.

Since we no longer publish at build time, postPublish hooks in app.json will not be executed on the build. If you use Sentry, update the sentry-expo library to the latest version and follow the updated instructions in Using Sentry. If you have other custom postPublish hooks, you can follow the same approach used in sentry-expo to support postPublish hook type of behavior.

However the "using sentry" docs still recommend adding the postPublish hook. This make it unclear how it should be configured.

Looking into the config plugin it seems that it relies on reading the sentry details from the postPublish hook section of the config file. This could definitely cause some confusion I think because AFAIK the postPublish hook is a deprecated thing that isn't recommended for use anymore now that we have EAS. Maybe it would be better to put the sentry config details in the extras.sentry section of the config?

A few warning are also emitted during Android build

 » android: sentry-expo: Could not find react.gradle script in android/app/build.gradle. Please open a bug report at https://github.com/expo/sentry-expo.
[RUN_GRADLEW] > Task :sentry_react-native:processReleaseManifest
[RUN_GRADLEW] package="io.sentry.react" found in source AndroidManifest.xml: /Users/imagio/dev/build_temp/build_android_24_19_05/build/apps/taskhero/node_modules/@sentry/react-native/android/src/main/AndroidManifest.xml.
@sentry/react-native/android/src/main/java/io/sentry/react/RNSentryModule.java uses or overrides a deprecated API.
warn Package @sentry/react-native contains invalid configuration: "dependency.platforms.ios.sharedLibraries" is not allowed,"dependency.hooks" is not allowed. Please verify it's properly linked using "react-native config" command and contact the package maintainers about this.

@evelant
Copy link

evelant commented Feb 25, 2023

@kbrandwijk @brentvatne I haven't been able to track it down... Since you appear to be the primary maintainers here I suspect you'll probably be able to spot the issue quickly.

It appears that sentry-expo does not work with EAS on Android with SDK 48. This will likely impact every expo-sentry user now that SDK 48 is out of beta. Is there any more information I can give you to help debug it? I haven't been able to find anything wrong with the config plugin other than outdated versions of the sentry SDKs in package.json. I suspect there has been some change either from sentry or in react-native 0.71 with android gradle that requires an update to this config plugin.

@kbrandwijk
Copy link
Member

The postPublish hook is currently only used to retrieve your Sentry configuration. I'll have a look at the Android issue.

@GeorgeBellTMH
Copy link

GeorgeBellTMH commented Mar 7, 2023

Just ran into this today - any word on when it will be published? It would seem a better idea to put the variables as secrets instead of as params in the json file given that checking those values in to git may allow for read/write access on sentry (beyond just creating new issues via the dsn - authToken has at minimum org:read, project:release and project:write according to documentation) ...

@garrettg123
Copy link

Experiencing this in SDK 47 as well with sentry-expo 6.0.0

@sergioisidoro
Copy link

sergioisidoro commented Mar 17, 2023

According to what I was able to find in the issue getsentry/sentry-react-native#2391 we're asked to upgrade sentry react native to >5.0.0 if we're using RN > 69.

Could updating the dependency @sentry/react-native": "4.13.0 to >5 be enough to solve this issue?

@sergioisidoro
Copy link

Btw, I would rename the issue description, because as @evelant mentioned:

It appears that sentry-expo does not work with EAS on Android with SDK 48

So it goes beyond postPublish not working, and it's a significant breaking change.

@evelant
Copy link

evelant commented Mar 17, 2023

@sergioisidoro I force upgraded the dependencies with pnpm overrides and it does not fix the issue. EAS build still fails to integrate the sentry sdk correctly resulting in no source maps being uploaded.

@evelant
Copy link

evelant commented Mar 17, 2023

I went through the code here and as far as I can tell it's setting up the sentry SDK correctly. I must have missed something or the issue is more subtle. @kbrandwijk when you have a chance could you look at this issue with eas build + sourcemaps on android?

@kbrandwijk
Copy link
Member

This was fixed in sentry-expo@6.1.0.

@RRaideRR
Copy link

RRaideRR commented Mar 21, 2023

Unfortunately, I cannot get it running for Android (iOS works however). I took this sample app and updated my dependencies to match the latest Expo SDK 48 release. In addition, I'm also using the url parameter because I have my own Sentry server. The source maps are not uploaded for Android eas builds.

I can see "Upload Debug Symbols to Sentry" in my fastlane logs but not in my gradle logs.

// Update: Seems like I'm not the only one.

@evelant
Copy link

evelant commented Mar 21, 2023

@kbrandwijk It appears that there's still an issue. After upgrading to 6.1.1 source maps are still not uploaded on Android.

@rcugut
Copy link

rcugut commented Mar 27, 2023

same problem after update:
sourcemaps are not uploading for Android, but they are uploading for iOS.

  • Expo SDK 48.0.9
  • sentry-expo@6.1.1

@erzaehlsalex
Copy link

What was the reason that this was closed? I cannot find an answer here how do deal with that. :( Or is there already a solution which was not mentioned here?

@dhcmega
Copy link

dhcmega commented Sep 13, 2023

Hi, I'm on SDK48 with "sentry-expo": "~6.2.0" (6.2.2 installed), and source maps are being uploaded.
Sentry is not reporting tho, but that might be another problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

10 participants