getsentry/sentry-unreal

sentry reported an error: Invalid org token (http status: 401) on Upload Debug Symbol Automatically when packaging for android

as3mbus opened this issue · 7 comments

Environment

How do you use Sentry?
Sentry SaaS (sentry.io) or self-hosted/on-premise (which version?)

Self Hosted

Which version of the SDK?
How did you install the package? (Git-URL, Assetstore)

0.15.1 Git Release - Marketplace Type

Which version of Unreal?

5.3.2

Is this happening in Unreal (editor) or on a player like Android, iOS, Windows?

Unreal Editor when packaging for android

Steps to Reproduce

  1. configure sentry following getting started guide
  2. set up Upload Debug Symbol Automatically
  3. disabled android file server plugin
  4. package android build for distribution with shipping build mode

Expected Result

  1. Build are produced without error
  2. Debug Symbol are uploaded to sentry server

Actual Result

  1. Build Failed with sentry error saying caused by: sentry reported an error: Invalid org token (http status: 401)
  2. i've tried with windows build and it works just fine

Any logs or screenshots

image

UATHelper: Packaging (Android (ASTC)): > Task :app:extractProguardFiles
UATHelper: Packaging (Android (ASTC)): > Task :app:processReleaseJavaRes NO-SOURCE
UATHelper: Packaging (Android (ASTC)): > Task :downloader_library:processReleaseJavaRes NO-SOURCE
UATHelper: Packaging (Android (ASTC)): > Task :downloader_library:bundleLibResRelease NO-SOURCE
UATHelper: Packaging (Android (ASTC)): > Task :permission_library:processReleaseJavaRes NO-SOURCE
UATHelper: Packaging (Android (ASTC)): > Task :permission_library:bundleLibResRelease NO-SOURCE
UATHelper: Packaging (Android (ASTC)): > Task :downloader_library:bundleLibRuntimeToJarRelease
UATHelper: Packaging (Android (ASTC)): > Task :permission_library:bundleLibRuntimeToJarRelease
UATHelper: Packaging (Android (ASTC)): > Task :downloader_library:bundleLibCompileToJarRelease
UATHelper: Packaging (Android (ASTC)): > Task :permission_library:bundleLibCompileToJarRelease
UATHelper: Packaging (Android (ASTC)): > Task :app:processReleaseResources
UATHelper: Packaging (Android (ASTC)): > Task :app:mergeReleaseJniLibFolders
UATHelper: Packaging (Android (ASTC)): > Task :app:compileReleaseJavaWithJavac
UATHelper: Packaging (Android (ASTC)): The following annotation processors are not incremental: lifecycle-compiler-2.0.0.jar (androidx.lifecycle:lifecycle-compiler:2.0.0).
UATHelper: Packaging (Android (ASTC)): Make sure all annotation processors are incremental to improve your build speed.
UATHelper: Packaging (Android (ASTC)): Note: Some input files use or override a deprecated API.
UATHelper: Packaging (Android (ASTC)): Note: Recompile with -Xlint:deprecation for details.
UATHelper: Packaging (Android (ASTC)): > Task :app:mergeReleaseGeneratedProguardFiles
UATHelper: Packaging (Android (ASTC)): > Task :downloader_library:mergeReleaseJniLibFolders
UATHelper: Packaging (Android (ASTC)): > Task :downloader_library:mergeReleaseNativeLibs NO-SOURCE
UATHelper: Packaging (Android (ASTC)): > Task :downloader_library:copyReleaseJniLibsProjectOnly
UATHelper: Packaging (Android (ASTC)): > Task :permission_library:mergeReleaseJniLibFolders
UATHelper: Packaging (Android (ASTC)): > Task :permission_library:mergeReleaseNativeLibs NO-SOURCE
UATHelper: Packaging (Android (ASTC)): > Task :permission_library:copyReleaseJniLibsProjectOnly
UATHelper: Packaging (Android (ASTC)): > Task :app:writeReleaseAppMetadata
UATHelper: Packaging (Android (ASTC)): > Task :downloader_library:prepareReleaseArtProfile
UATHelper: Packaging (Android (ASTC)): > Task :permission_library:prepareReleaseArtProfile
UATHelper: Packaging (Android (ASTC)): > Task :app:collectReleaseDependencies
UATHelper: Packaging (Android (ASTC)): > Task :app:configureReleaseDependencies
UATHelper: Packaging (Android (ASTC)): > Task :app:validateSigningRelease
UATHelper: Packaging (Android (ASTC)): > Task :app:parseReleaseIntegrityConfig
UATHelper: Packaging (Android (ASTC)): > Task :app:mergeReleaseArtProfile
UATHelper: Packaging (Android (ASTC)): > Task :app:mergeReleaseJavaResource
UATHelper: Packaging (Android (ASTC)): > Task :app:mergeReleaseNativeLibs
UATHelper: Packaging (Android (ASTC)): > Task :app:stripReleaseDebugSymbols
UATHelper: Packaging (Android (ASTC)): > Task :app:extractReleaseNativeSymbolTables
UATHelper: Packaging (Android (ASTC)): > Task :app:minifyReleaseWithR8
UATHelper: Packaging (Android (ASTC)): > Task :app:uploadSentryProguardMappingsRelease FAILED
UATHelper: Packaging (Android (ASTC)): > compressing mappings
UATHelper: Packaging (Android (ASTC)): > uploading mappings
UATHelper: Packaging (Android (ASTC)): error: API request failed
UATHelper: Packaging (Android (ASTC)):   caused by: sentry reported an error: Invalid org token (http status: 401)
UATHelper: Packaging (Android (ASTC)): Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
UATHelper: Packaging (Android (ASTC)): Please attach the full debug log to all bug reports.
UATHelper: Packaging (Android (ASTC)): FAILURE: Build failed with an exception.
UATHelper: Packaging (Android (ASTC)): * What went wrong:
UATHelper: Packaging (Android (ASTC)): Execution failed for task ':app:uploadSentryProguardMappingsRelease'.
UATHelper: Packaging (Android (ASTC)): > Process 'command 'cmd'' finished with non-zero exit value 1
UATHelper: Packaging (Android (ASTC)): * Try:
UATHelper: Packaging (Android (ASTC)): > Run with --stacktrace option to get the stack trace.
UATHelper: Packaging (Android (ASTC)): > Run with --info or --debug option to get more log output.
UATHelper: Packaging (Android (ASTC)): > Run with --scan to get full insights.
UATHelper: Packaging (Android (ASTC)): * Get more help at https://help.gradle.org
UATHelper: Packaging (Android (ASTC)): Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
UATHelper: Packaging (Android (ASTC)): You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
UATHelper: Packaging (Android (ASTC)): See https://docs.gradle.org/7.5/userguide/command_line_interface.html#sec:command_line_warnings
UATHelper: Packaging (Android (ASTC)): BUILD FAILED in 1m 13s
UATHelper: Packaging (Android (ASTC)): 79 actionable tasks: 79 executed
UATHelper: Packaging (Android (ASTC)): cmd.exe failed with args /c "D:\Projects\MyMobileProject\Intermediate\Android\gradle\rungradle.bat" :app:bundleRelease
UATHelper: Packaging (Android (ASTC)): (see C:\Users\Crew\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+EpicGames+UE_5.3\Log.txt for full exception trace)
UATHelper: Packaging (Android (ASTC)): AutomationTool executed for 0h 3m 55s
UATHelper: Packaging (Android (ASTC)): AutomationTool exiting with ExitCode=1 (Error_Unknown)
UATHelper: Packaging (Android (ASTC)): BUILD FAILED
PackagingResults: Error: Unknown Error

@as3mbus Please check whether the credentials for symbol uploading are valid - it looks like there is some mismatch between the project/org name and the token being used.

i've tried with windows build and it works just fine

Сan you confirm that for this particular platform symbols were uploaded as expected? This step simply could've been skipped if Windows is disabled in Project Settings -> Sentry -> Misc -> Enable for Build Platform Types menu

thank you for responding.

that might be the cause yes, but can you help me whether or not i'm filling in the correct credentials.

e.g: my sentry project url page are like this https://my.sentry.id/organizations/test-org/projects/unreal-sentry-testing

thus i fill project name with unreal-sentry-testing and organization name with test-org, and token are made from organization auth token. should i changed it to the user token ?

additionally, yes the window platform symbols are uploaded. since previously i tried disabling the auto upload. and only got memory call stack, when i got an issue.

below are screenshot of the settings

image

thus i fill project name with unreal-sentry-testing and organization name with test-org, and token are made from organization auth token. should i changed it to the user token ?

I think using the organization token might be the case here - please give it another try with a user token instead.
Yet it's a bit odd that for Windows things are working okay.

hey it worked, at least it shows up different error message when packaging shipping android build

below are the log

UATHelper: Packaging (Android (ASTC)): > Task :app:processReleaseResources
UATHelper: Packaging (Android (ASTC)): > Task :app:mergeReleaseNativeLibs
UATHelper: Packaging (Android (ASTC)): > Task :app:compileReleaseJavaWithJavac
UATHelper: Packaging (Android (ASTC)): The following annotation processors are not incremental: lifecycle-compiler-2.0.0.jar (androidx.lifecycle:lifecycle-compiler:2.0.0).
UATHelper: Packaging (Android (ASTC)): Make sure all annotation processors are incremental to improve your build speed.
UATHelper: Packaging (Android (ASTC)): Note: Some input files use or override a deprecated API.
UATHelper: Packaging (Android (ASTC)): Note: Recompile with -Xlint:deprecation for details.
UATHelper: Packaging (Android (ASTC)): > Task :app:mergeReleaseGeneratedProguardFiles
UATHelper: Packaging (Android (ASTC)): > Task :app:mergeReleaseJavaResource
UATHelper: Packaging (Android (ASTC)): > Task :app:stripReleaseDebugSymbols
UATHelper: Packaging (Android (ASTC)): > Task :app:extractReleaseNativeSymbolTables
UATHelper: Packaging (Android (ASTC)): > Task :app:minifyReleaseWithR8
UATHelper: Packaging (Android (ASTC)): > Task :app:uploadSentryProguardMappingsRelease FAILED
UATHelper: Packaging (Android (ASTC)): > compressing mappings
UATHelper: Packaging (Android (ASTC)): > uploading mappings
### UATHelper: Packaging (Android (ASTC)): error: request failed because API URL was incorrectly formatted
UATHelper: Packaging (Android (ASTC)):   caused by: bad sentry url: unknown scheme (https:)
UATHelper: Packaging (Android (ASTC)): Add --log-level=[info|debug] or export SENTRY_LOG_LEVEL=[info|debug] to see more output.
UATHelper: Packaging (Android (ASTC)): Please attach the full debug log to all bug reports.
UATHelper: Packaging (Android (ASTC)): FAILURE: Build failed with an exception.
UATHelper: Packaging (Android (ASTC)): * What went wrong:
### UATHelper: Packaging (Android (ASTC)): Execution failed for task ':app:uploadSentryProguardMappingsRelease'.
UATHelper: Packaging (Android (ASTC)): > Process 'command 'cmd'' finished with non-zero exit value 1
UATHelper: Packaging (Android (ASTC)): * Try:
UATHelper: Packaging (Android (ASTC)): > Run with --stacktrace option to get the stack trace.
UATHelper: Packaging (Android (ASTC)): > Run with --info or --debug option to get more log output.
UATHelper: Packaging (Android (ASTC)): > Run with --scan to get full insights.
UATHelper: Packaging (Android (ASTC)): * Get more help at https://help.gradle.org
UATHelper: Packaging (Android (ASTC)): Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.
UATHelper: Packaging (Android (ASTC)): You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.
UATHelper: Packaging (Android (ASTC)): See https://docs.gradle.org/7.5/userguide/command_line_interface.html#sec:command_line_warnings
UATHelper: Packaging (Android (ASTC)): BUILD FAILED in 55s
UATHelper: Packaging (Android (ASTC)): 79 actionable tasks: 79 executed
UATHelper: Packaging (Android (ASTC)): cmd.exe failed with args /c "D:\Projects\MyMobileProject\Intermediate\Android\gradle\rungradle.bat" :app:bundleRelease
UATHelper: Packaging (Android (ASTC)): (see C:\Users\Crew\AppData\Roaming\Unreal Engine\AutomationTool\Logs\D+EpicGames+UE_5.3\Log.txt for full exception trace)
UATHelper: Packaging (Android (ASTC)): AutomationTool executed for 0h 7m 58s
UATHelper: Packaging (Android (ASTC)): AutomationTool exiting with ExitCode=1 (Error_Unknown)
UATHelper: Packaging (Android (ASTC)): BUILD FAILED
PackagingResults: Error: Unknown Error

i highlighted the log with ###

additionally what permission are required for the user token to upload debug symbol ?
for testing this issue i grant all admin permission to made user token.

UATHelper: Packaging (Android (ASTC)): error: request failed because API URL was incorrectly formatted
UATHelper: Packaging (Android (ASTC)): caused by: bad sentry url: unknown scheme (https:)

I believe this error comes from sentry-cli (a tool that plugin uses under the hood for symbol uploading) yet I'm not quite sure what's wrong about that URL here.

/// Returns the base url (without trailing slashes)
pub fn get_base_url(&self) -> Result<&str> {
    let base = self.cached_base_url.trim_end_matches('/');
    if !is_absolute_url(base) {
        bail!("bad sentry url: unknown scheme ({})", base);
    }
    if base.matches('/').count() != 2 {
        bail!("bad sentry url: not on URL root ({})", base);
    }
    Ok(base)
}

/// Checkes whether an url starts with http:// or https:// prefix
pub fn is_absolute_url(url: &str) -> bool {
    url.starts_with("http://") || url.starts_with("https://")
}

Please add defaults.url=https://sentry.io/ manually to sentry.properties file which is supposed to be generated at your Unreal project root dir and give it another shot by doing a clean build (remove Intermediate, Binaries and Build folders first).

Also, do you have SENTRY_DSN/SENTRY_URL env variables set on your machine? After browsing through a bunch of similar GitHub issues I found out that sometimes these can interfere with normal sym uploading flow.

additionally what permission are required for the user token to upload debug symbol ?

Granting it read/write permissions should be enough.

Please add defaults.url=https://sentry.io/ manually to sentry.properties file which is supposed to be generated at your Unreal project root dir and give it another shot by doing a clean build (remove Intermediate, Binaries and Build folders first)

this do the trick.

i already configured this before pointing to my self hosted sentry server url
but after changing the token, the url changed to https:/

this do the trick.

Great, thank you for the update and glad that this workaround helped!

but after changing the token, the url changed to https:/

I assume sentry.properties could have been changed like this if you modify sym uploading credentials via the Sentry settings menu in UE editor. Basically, it alters the file content whenever receiving updates from the corresponding inputs and since no other properties are expected to be in there something could've gone wrong.