Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Building a Unity game for iOS with fastlane fails with missing USYM_UPLOAD_AUTH_TOKEN

I'm building my Unity game for iOS using fastlane, but ever since I enabled Unity's Cloud Diagnostics my iOS build has been failing with the message Please provide an auth token with USYM_UPLOAD_AUTH_TOKEN environment variable

This error message has caused fastlane to fail at ARCHIVE FAILED when building for the app store.

like image 255
Sean Saleh Avatar asked Mar 03 '23 23:03

Sean Saleh


1 Answers

Try the following to get your builds passing:

  • If you are building the Unity project from commandline with -batchmode, be sure to pass in -username and -password to Unity as well. [source]
  • Ensure the user you are using to log in to Unity has access to the project in Unity's developer dashboard
  • If you are using an older version of Unity be sure to upgrade, there was a known bug related to this
  • If none of these work, try setting the environment variable USYM_UPLOAD_AUTH_TOKEN to an arbitrary value. This will make uploading the symbol files to Unity's servers fail, but should cause your build to pass. [source]
  • You can also just disable Unity Cloud Diagnostics again to get it working immediately.

This issue occurs because enabling Unity's Cloud Diagnostics tell the Xcode Project to upload the symbol files to Unity's servers as part of building the game. That way you they have symbol files to help you process game crashes.

A bit of how this all works: You must log in to Unity so it can get a token to use for uploading the game's symbol files. Then, Unity sets the values USYM_UPLOAD_URL_SOURCE and USYM_UPLOAD_AUTH_TOKEN inside the generated Unity-iPhone.xcodeproj/project.pbxproj. During the xcode build there are two tools, usymtool and process_symbols.sh which use these values to send the symbols to Unity. You can find usymtool's logs at ~/Library/Logs/Unity/symbol_upload.log.

like image 65
Sean Saleh Avatar answered Mar 05 '23 11:03

Sean Saleh