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

Android app bundle build fails with error message "A release slug is required" #3528

Closed
5 of 11 tasks
n-kulic opened this issue Jan 16, 2024 · 9 comments · Fixed by #3540
Closed
5 of 11 tasks

Android app bundle build fails with error message "A release slug is required" #3528

n-kulic opened this issue Jan 16, 2024 · 9 comments · Fixed by #3540

Comments

@n-kulic
Copy link

n-kulic commented Jan 16, 2024

OS:

  • Windows
  • MacOS
  • Linux

Platform:

  • iOS
  • Android

SDK:

  • @sentry/react-native (>= 1.0.0)
  • react-native-sentry (<= 0.43.2)

SDK version: 0.0.0

react-native version: 5.15.2

Are you using Expo?

  • Yes
  • No

Are you using sentry.io or on-premise?

  • sentry.io (SaaS)
  • on-premise

If you are using sentry.io, please post a link to your issue so we can take a look:
N/A

Configuration:

(@sentry/react-native)

Sentry.init({
  dsn: 'https://[email protected]/4',
});

I have the following issue:

Android app bundle build is failing, i.e. ./gradlew bundleRelease command.

Steps to reproduce:

  • Step 1: Generate new react-native project npx react-native@latest init AwesomeProject
  • Step 2: Run Sentry Wizard npx @sentry/wizard@latest -s -i reactNative
  • Step 3: Manage app signing (automatic or manual)
  • Step 3: Run build command ./gradlew bundleRelease

Actual result:
Build fails with following error:

Processing react-native sourcemaps for Sentry upload.
> Analyzing 2 sources
> Rewriting sources
> Adding source map references
-error: This version of Sentry does not support artifact bundles. A release slug is required (provide with --release)
Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
Please attach the full debug log to all bug reports.

And based on source code this seems intentional:
sentry.gradle line 133

def notIncludeRelease = "$bundleCommand" == "bundle" && exitValue == 0
def not = notIncludeRelease ? 'not ' : ''
project.logger.lifecycle("Sentry Source Maps upload will ${not}include the release name and dist.")
extraArgs.addAll(notIncludeRelease ? [] : [
    "--release", releaseName,
    "--dist", versionCode
])

Specifically the following part:

def notIncludeRelease = "$bundleCommand" == "bundle" && exitValue == 0:

Why are release args not included when building app bundle?

Expected result:
Build to succeed.

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 2 Jan 16, 2024
@n-kulic n-kulic changed the title Android build failing with error message "A release slug is required" Android app bundle build fails with error message "A release slug is required" Jan 17, 2024
@krystofwoldrich
Copy link
Member

Hi @n-kulic,
thank you for the message,
yes, this was intentional as the release and dist are not needed when debug IDs are used. This must be supported by the Sentry backend (since 23.3.0).

You can set the release and dist using envs, SENTRY_RELEASE and SENTRY_DIST would that work for you?

@krystofwoldrich krystofwoldrich moved this from Needs Discussion to Needs More Information in Mobile & Cross Platform SDK Jan 17, 2024
@getsantry getsantry bot moved this to Waiting for: Community in GitHub Issues with 👀 2 Jan 17, 2024
@n-kulic
Copy link
Author

n-kulic commented Jan 17, 2024

Hi @n-kulic, thank you for the message, yes, this was intentional as the release and dist are not needed when debug IDs are used. This must be supported by the Sentry backend (since 23.3.0).

You can set the release and dist using envs, SENTRY_RELEASE and SENTRY_DIST would that work for you?

I'm not quite sure where should i set release and dist values?
Would it be in android/app/build.gradle?

apply plugin: "io.sentry.android.gradle"

sentry {
    release = ...?
}

Or you meant i have to set those env variables manually?
Is there any possibilities to set them automatically?

@getsantry getsantry bot moved this from Waiting for: Community to Waiting for: Product Owner in GitHub Issues with 👀 2 Jan 17, 2024
@devenvyas
Copy link

Hi @n-kulic, thank you for the message, yes, this was intentional as the release and dist are not needed when debug IDs are used. This must be supported by the Sentry backend (since 23.3.0).
You can set the release and dist using envs, SENTRY_RELEASE and SENTRY_DIST would that work for you?

I'm not quite sure where should i set release and dist values? Would it be in android/app/build.gradle?

apply plugin: "io.sentry.android.gradle"

sentry {
    release = ...?
}

Or you meant i have to set those env variables manually? Is there any possibilities to set them automatically?

@n-kulic I am facing the exact same issue. Have you figured out how these env variables need to be passed.

@krystofwoldrich
Copy link
Member

At the moment you would need to set the environmental variables manually.

https://docs.sentry.io/platforms/react-native/sourcemaps/troubleshooting/optional-release-and-distribution/

@krystofwoldrich krystofwoldrich moved this from Needs More Information to Needs Discussion in Mobile & Cross Platform SDK Jan 18, 2024
@n-kulic
Copy link
Author

n-kulic commented Jan 18, 2024

At the moment you would need to set the environmental variables manually.

https://docs.sentry.io/platforms/react-native/sourcemaps/troubleshooting/optional-release-and-distribution/

I've exported SENTRY_RELEASE and SENTRY_DIST env variables (exactly as it is written in docs) before running ./gradlew bundleRelease and I still get the error:
image

@getsantry getsantry bot moved this to Waiting for: Product Owner in GitHub Issues with 👀 2 Jan 18, 2024
@krystofwoldrich
Copy link
Member

@n-kulic Thank you, we will check it.

@github-project-automation github-project-automation bot moved this from Needs Discussion to Done in Mobile & Cross Platform SDK Jan 22, 2024
@phuocantd
Copy link

At the moment you would need to set the environmental variables manually.
https://docs.sentry.io/platforms/react-native/sourcemaps/troubleshooting/optional-release-and-distribution/

I've exported SENTRY_RELEASE and SENTRY_DIST env variables (exactly as it is written in docs) before running ./gradlew bundleRelease and I still get the error: image

same here, how to fix it?

@krystofwoldrich
Copy link
Member

@phuocantd Thank you for the message, ale you using the latest RN SDK including this fix?

Please consider opening a new issue, since this thread is almost half a year old.

@phuocantd
Copy link

@phuocantd Thank you for the message, ale you using the latest RN SDK including this fix?

Please consider opening a new issue, since this thread is almost half a year old.

Looks like I've fixed it

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

Successfully merging a pull request may close this issue.

4 participants