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

Disable sourcemaps file upload for debug builds #525

Closed
sourabhv opened this issue Dec 21, 2018 · 11 comments
Closed

Disable sourcemaps file upload for debug builds #525

sourabhv opened this issue Dec 21, 2018 · 11 comments

Comments

@sourabhv
Copy link

Is there a way to disable uploading sourcemaps for android and iOS debug builds?

I can add add if [ "${CONFIGURATION}" = "Release" ]; then ... check for ios run script but I don't understand why does that even run in debug scheme

@OleksandrKucherenko
Copy link
Contributor

OleksandrKucherenko commented Jan 29, 2019

/* Disable Sentry tasks for test environments / flavors. */
gradle.projectsEvaluated {
    // Grab all build types and product flavors
    def buildTypes = android.buildTypes.collect { type -> type.name }
    def productFlavors = android.productFlavors.collect { flavor -> flavor.name }

    // When no product flavors defined, use empty
    if (!productFlavors) productFlavors.add("")

    productFlavors.each { flavor ->
        buildTypes.each { buildt ->
            def isEnabled = !isTestEnvironment(flavor.toString())
            /* disable sentry tasks for test environments */
            [
                    "bundle${flavor.capitalize()}${buildt.capitalize()}JsAndAssets${flavor}-${buildt}SentryUpload",
                    "bundle${flavor.capitalize()}${buildt.capitalize()}JsAndAssets${flavor}-${buildt}SentryUploadCleanUp",
            ].each { name ->
                def task = tasks.findByPath(name)
                if (null != task) {
                    task.enabled = isEnabled
                    task.group = "sentry.io"
                }
            }
        }
    }
}

/** Is flavor variation recognized as test environment. */
static isTestEnvironment(variantName) {
    return variantName.startsWith("appium")
}

@sorrat
Copy link

sorrat commented Feb 4, 2019

A shorter version:

gradle.projectsEvaluated {
    def tasksToSkip = project.tasks.matching {
        it.name.contains("SentryUpload") &&
        it.name.contains("Debug")
    }
    tasksToSkip.all { enabled = false }
}

@jussirantala
Copy link

jussirantala commented Apr 4, 2019

A shorter version:

gradle.projectsEvaluated {
    def tasksToSkip = project.tasks.matching {
        it.name.contains("SentryUpload") &&
        it.name.contains("Debug")
    }
    tasksToSkip.all { enabled = false }
}

So I should directly modify ./node_modules/react-native-sentry/sentry.gradle? Is there a way to do this in my main build.gradle or app/build.gradle?

@OleksandrKucherenko
Copy link
Contributor

@jussirantala you can place this code into app/build.gradle

@jussirantala
Copy link

@jussirantala you can place this code into app/build.gradle

I added it at the end of the file but nothing changed

@gianpaj
Copy link

gianpaj commented Jun 3, 2019

Since version 0.42.0 sourcemap files are not uploaded by default on Android.

https://github.com/getsentry/react-native-sentry/blob/master/CHANGELOG.md#0420

Edit: This is PR that fixed this: #546

@OleksandrKucherenko
Copy link
Contributor

@gianpaj it was in PR #546

@gianpaj
Copy link

gianpaj commented Jun 3, 2019

cool, thanks @OleksandrKucherenko

@sourabhv sourabhv closed this as completed Jun 6, 2019
@jstheoriginal
Copy link

Any idea how to also prevent uploading to sentry just from running UnitTests? Every prod release it uploads twice. first for the job running the unit tests and then secondly for the actual app bundle job.

@AlirezaHadjar
Copy link

@jussirantala you can place this code into app/build.gradle

I added it at the end of the file but nothing changed

Just in case, the code @sorrat mentioned should be added after this line:
apply from: new File(["node", "--print", "require('path').dirname(require.resolve('@sentry/react-native/package.json'))"].execute().text.trim(), "sentry.gradle")

So it would be like this:

Image

@krystofwoldrich
Copy link
Member

Hello everyone,
this is quite an old issue. Since 2019 the SDK evolved and not automatic source maps upload can be disabled by export SENTRY_DISABLE_AUTO_UPLOAD=true env both for iOS and Android.

Read more at https://docs.sentry.io/platforms/react-native/sourcemaps/#disable-automatic-upload

@getsentry getsentry locked as resolved and limited conversation to collaborators Oct 21, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants