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

[Bug] INVALID_APP_ID error on Android #1017

Open
SHiLLySiT opened this issue May 7, 2024 · 9 comments
Open

[Bug] INVALID_APP_ID error on Android #1017

SHiLLySiT opened this issue May 7, 2024 · 9 comments

Comments

@SHiLLySiT
Copy link

SHiLLySiT commented May 7, 2024

What is your question?

I'm troubleshooting what is likely a configuration error on my end, but I'm having trouble narrowing down the problem due to a vague error message.

Our build fails to login with the error An internal error has occurred. [ INVALID_APP_ID ]. Frustratingly this is only occurring when the game is built in our production pipeline, so I don't have a full call stack.

I can't find any documentation that specifies what app id the error is referring to (e.g. is it the mobile bundle id, the Firebase app id, or something else) other than this page which simply has INVALID_APP_ID's string value. This page has a list of helpful descriptions of exceptions, but I'm not sure which one this error maps to, if any.

Can someone provide some additional info on why the INVALID_APP_ID error occurs, and what might be some things to look into?

Firebase Unity SDK Version

11.7.0

Unity editor version

2022.3.10

Installation Method

.unitypackage

Problematic Firebase Component(s)

Authentication

Other Firebase Component(s) in use

Authentication

Additional SDKs you are using

No response

Targeted Platform(s)

Android

Unity editor platform

Windows

Scripting Runtime

IL2CPP

Release Distribution Type

Pre-built SDK from https://firebase.google.com/download/unity

@google-oss-bot
Copy link

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

@argzdev
Copy link

argzdev commented May 8, 2024

Hey @SHiLLySiT, thanks for reaching out. So far, I'm not experiencing any issues with running our quickstart Auth in the Unity Editor, and in an Android Emulator with either custom keystore or debug keystore. That said, could you answer a few questions below just as a sanity check:

  1. Which login provider are you having this issue? Is Firebase Auth working for other login providers?
  2. Have you enabled the login providers you're currently using in the Firebase Console?
  3. Lastly, have you checked if your Firebase project's client_id and project_id is correctly indicated in your Android app google-services.json? If not, could you try replacing this with the correct json file and see if that helps.

Let me know if these help. Thanks!

@argzdev argzdev added the needs-info Need information for the developer label May 8, 2024
@SHiLLySiT
Copy link
Author

SHiLLySiT commented May 8, 2024

Hi @argzdev, thanks for the reply!

To clarify, I don't think this is a problem on your end. Our project has a production and development Firebase project, and the development one had been working just fine. I think I've just missed something when flipping it over to production, but I'm just having trouble figure out what because the error isn't specific enough about the issue.

  1. We're using Microsoft, but we also have Google enabled because of this other issue. However we aren't actually using Google, so I cant speak to if other login providers are working or not.
  2. Yup!
  3. I've been thinking the problem was with the google-services.json but I've replaced it several times now and git hasn't actually shown any difference in the files. Unless somehow the Firebase Console isn't spitting out the right file?

Let me know if you have any other ideas!

EDIT: We also support WebGL and iOS, both of which are working with the production Firebase project, so I think its something specific to the Android. I'm not sure if it matters, but I had deleted a few previous Android apps from the console as we had some miscommunication on what the bundle id was. However I've double checked that the bundle id for the active app is the correct one.

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels May 8, 2024
@SHiLLySiT
Copy link
Author

I pulled the ADB logs from a development build, stack trace wasn't super helpful:

05-08 12:37:32.486 10927 10948 E Unity   : One or more errors occurred. (An internal error has occurred. [ INVALID_APP_ID ])
05-08 12:37:32.486 10927 10948 E Unity   :  #0 0x73d6b1d868 (libunity.so) GetStacktrace(int) 0x44
05-08 12:37:32.486 10927 10948 E Unity   :  #1 0x73d705927c (libunity.so) DebugStringToFile(DebugStringToFileData const&) 0x234
05-08 12:37:32.486 10927 10948 E Unity   :  #2 0x73d66d0720 (libunity.so) DebugLogHandler::Internal_Log(LogType, LogOption, core::basic_string<char, core::StringStorageDefault<char> >, Object*) 0x9c
05-08 12:37:32.486 10927 10948 E Unity   :  #3 0x73d66d060c (libunity.so) DebugLogHandler_CUSTOM_Internal_Log(LogType, LogOption, ScriptingBackendNativeStringPtrOpaque*, ScriptingBackendNativeObjectPtrOpaque*) 0x15c
05-08 12:37:32.486 10927 10948 E Unity   :  #4 0x73d4512304 (libil2cpp.so) ? 0x0
05-08 12:37:32.486 10927 10948 E Unity   :  #5 0x73d52f5e44 (libil2cpp.so) ? 0x0
05-08 12:37:32.486 10927 10948 E Unity   :  #6 0x73d520c27c (libil2cpp.so) ? 0x0
05-08 12:37:32.486 10927 10948 E Unity   :  #7 0x73d5305718 (libil2cpp.so) ? 0x0
05-08 12:37:32.486 10927 10948 E Unity   :  #8 0x73d5301fe8 (libil2cpp.so) ? 0x0
05-08 12:37:32.486 10927 10948 E Unity   :  #9 0x73d4b9be9c (libil2cpp.so) ? 0x0
05-08 12:37:32.486 10927 10948 E Unity   :  #10 0x73d4bd8a58 (libil2cpp.so) ? 0x0
05-08 12:37:32.486 10927 10948 E Unity   :  #11 0x73d44f766c (libil2cpp.so) ? 0x0
05-08 12:37:32.486 10927 10948 E Unity   :  #12 0x73d52f5e44 (libil2cpp.so) ? 0x0
05-08 12:37:32.486 10927 10948 E Unity   :  #13 0x73d520c27c (libil2cpp.so) ? 0x0
05-08 12:37:32.486 10927 10948 E Unity   :  #14 0x73d5305718 (libil2cpp.so) ? 0x0
05-08 12:37:32.486 10927 10948 E Unity   :  #15 0x73d5301fe8 (libil2cpp.so

But there was this system log:

FirebaseAuth: [GetAuthDomainTask] Error getting project config. Failed with INVALID_APP_ID 400

I'm still not quite sure what the issue is, but seems more likely its related to the google-services.json? The odd bit is that a local build works fine, so there's something going wrong when building headless.

@SHiLLySiT
Copy link
Author

Okay turns out that this is a bug 😕 I'd change the tag on this but looks like I don't have permissions to.

When integrating Firebase initially into our project, I made a local build with the configs for the development project and checked in the auto-generated file Assets\Plugins\Android\FirebaseApp.androidlib\res\values\google-services.xml along with all the other auto-generated files in the Assets\Plugins\Android. While this file is regenerated for local builds, it is not regenerated when running Unity headless.

My work around for now was just to manually check in the updated google-services.xml after making a local build with our configs for the production project. However IMO, Firebase should generate the same files when running headless or not.

Also related: I've been perplexed that there isn't guidance on what files can be ignored. I initially assumed all auto generated files could be ignored, which seemed to be supported by this comment. However, after running into other issues, I ended up checking in all files. Still not clear if this is what's intended or not, so would be awesome to have some official documentation on that.

@argzdev
Copy link

argzdev commented May 10, 2024

Hey @SHiLLySiT, I must say this is an impressive investigation. Thanks for sharing your thoughts and the outcome of the investigation. This has been very insightful. Can you explain more about your usage of Unity Headless?

Correct me if I'm wrong, from my understanding, you have a production pipeline that whenever files are checked-in, it will automatically build, generate, and run a unity headless server. Which in this case, does not re-generate the google-services.xml?

As for the documentations, we'll try and work something out, I'll have to bring it up to our engineers for discussion.

@argzdev argzdev added needs-info Need information for the developer and removed needs-attention Need Googler's attention labels May 13, 2024
@SHiLLySiT
Copy link
Author

@argzdev No problem!

When referring to running Unity headless, I was referring to running Unity via command line without the GUI. We specifically use the -executeMethod parameter to execute a method in our project which eventually just calls BuildPipeline.BuildPlayer().

I was trying to get you a simple project that reproduces the issue, however I can't seem to cut down the project enough to git past Github's file size limit 😕

However it was simple to setup:

  1. Create a new project with Unity 2022.3.10. Not sure if the version is important, but this is the one my project is using.
  2. Add FirebaseAuth 11.7.0. Again not sure if version is important, but this is the one my project is using.
  3. Download google-services.json from a Firebase project and add to root of Assets/.
  4. Make an Android build.
  5. Observe that Assets\Plugins\Android\FirebaseApp.androidlib\res\values\google-services.xml is automatically created.
  6. Either:
    • Modify google-services.xml by hand to use different values than what exist in google-services.json.
    • Replace google-services.json with one from another Firebase project.
  7. Make another Android build.
  8. ----> Observe that Assets\Plugins\Android\FirebaseApp.androidlib\res\values\google-services.xml is not updated.

Important note: this behaves a slightly differently than what I described in my previous comment. Once the file Assets\Plugins\Android\FirebaseApp.androidlib\res\values\google-services.xml is generated, it is never updated again regardless if I make a manual build, running Unity via command line, or manually invoking BuildPipeline.BuildPlayer().

@google-oss-bot google-oss-bot added needs-attention Need Googler's attention and removed needs-info Need information for the developer labels May 13, 2024
@argzdev
Copy link

argzdev commented May 27, 2024

Hey @SHiLLySiT, thanks for the extra information. We really appreciate it! I was able to reproduce the behavior by testing a bunch of scenarios.

Scenario 1

  1. delete google-services.json
  2. add new google-services.json
  3. the google-services.xml does not change - incorrect

Scenario 2

  1. update google-services.json manually
  2. google-services.xml does not change - incorrect

Scenario 3

  1. delete google-services.json
  2. delete google-services.xml
  3. add new google-services.json
  4. new google-services.xml is created - correct

Scenario 4

  1. delete google-services.json
  2. change platform to macOS, then back to Android
  3. google-services.xml is updated - correct

I'll go ahead and inform our engineering team to see what we can do here. Thanks!

@looptheloop88 looptheloop88 removed the needs-attention Need Googler's attention label Jun 24, 2024
@SHiLLySiT
Copy link
Author

I ran into this same problem on another project. This time with Firebase 12.1.0 and Unity 2022.3.36.

@SHiLLySiT SHiLLySiT changed the title [Question] INVALID_APP_ID error on Android [Bug] INVALID_APP_ID error on Android Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants