[Bug] latest Firebase .tgz files cannot be imported by Unity: TAR_ENTRY_INVALID: invalid base256 encoding
Description
When trying to install the Firebase Unity SDK via Unity Package Manager using the .tgz packages from the official Google archive, Unity fails to resolve the packages with:
TAR_ENTRY_INVALID: invalid base256 encoding
This happens for both com.google.firebase.app and com.google.firebase.messaging (and also with different versions (13.6.0, 13.5.0, 12.10.1), even though the .tgz files are downloaded directly from the official download URLs and referenced via file: as documented.
Same procedure for external-dependency-manager-1.2.186 works fine.
I ended up falling back to the .unitypackage installation method, which works, but the .tgz UPM flow appears to be broken.
Reproducing the issue
Environment
- Unity: Unity 6.2 / 6000.2.6f2
- OS: Windows 11
- Firebase Unity SDK version: 13.6.0
- Installation method attempted: Unity Package Manager, via
.tgzfiles +manifest.json - Products:
-
com.google.firebase.app -
com.google.firebase.messaging -
com.google.external-dependency-manager(EDM)
-
Packages / Files Used
Downloaded the .tgz archives from the official Google packages for Unity archive (linked from the Firebase docs “Additional Unity installation options”):
-
com.google.external-dependency-manager-1.2.186.tgz(worked) -
com.google.firebase.app-13.6.0.tgz(failed) -
com.google.firebase.messaging-13.6.0.tgz(failed)
Placed them in a folder next to the Unity project, e.g.:
-
../GooglePackages/com.google.external-dependency-manager-1.2.186.tgz -
../GooglePackages/com.google.firebase.app-13.6.0.tgz -
../GooglePackages/com.google.firebase.messaging-13.6.0.tgz
manifest.json snippet
Packages/manifest.json (simplified):
{
"dependencies": {
"com.google.external-dependency-manager": "file:../GooglePackages/com.google.external-dependency-manager-1.2.186.tgz",
"com.google.firebase.app": "file:../GooglePackages/com.google.firebase.app-13.6.0.tgz",
"com.google.firebase.messaging": "file:../GooglePackages/com.google.firebase.messaging-13.6.0.tgz"
// plus the usual com.unity.* entries...
}
}
### Firebase Unity SDK Version
13.6.0
### Unity editor version
6000.2.6f2
### Installation Method
Unity Package Manager
### Problematic Firebase Component(s)
Messaging
### Other Firebase Component(s) in use
_No response_
### Additional SDKs you are using
_No response_
### Targeted Platform(s)
Android, Apple Platforms, Desktop
### Unity editor platform
Windows
### Scripting Runtime
IL2CPP, Mono
### Release Distribution Type
Open-source from this repo
### Relevant Log Output
```shell
If using CocoaPods for Apple platforms, the project's Podfile.lock
Expand Podfile.lock snippet
👀 Replace this line with the contents of your Podfile.lock!
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
Hi @dorn-gerhard, thanks for reaching out. I tried setting up this sample project for Google Analytics, but I didn't encounter any issues with importing the .tgz file for the Analytics SDK. Though I did my testing on an M1 MacOS machine.
I think this might be more of an issue with the machine you're using, similar to this issue (#1363). Just to confirm, could you check if you're able to reproduce this on a different machine, or if the workaround using curl commands mentioned here helps resolve the issue?
This is a really bug issue for me as well as i nées to upgrade those packages for 16kb pages requirements
Hi @niccolo-hare , the hint with different OS helped me solve the problem. On MacOS a tgz file is unzipped to tar file when downloaded automatically. If you do that on a Windows machine (e.g. open the tgz with 7zip and extract the tar file and add them in the manifest with that file ending com.google.firebase.app-13.6.0.tar", it seems to work.
Interestingly unzipping is not necessary with the dependency manager as it is compressed with different OS (this is at least the difference i could see in 7zip)
Maybe you zip the tar files such they work for both OS out of the box or add a comment to unzip tgz files on windows machines
Thanks for these details @dorn-gerhard. I'm curious regarding why your tgz files were unzipped after downloading them, since that behavior didn't happen for me. What I did on my testing was I downloaded the necessary .tgz files from this archive, then I imported them in order based on this guide using the Unity Package Manager ('+' plus icon > "install package from tarball"). They were downloaded as just .tgz files and were still zipped when I imported them for my testing.
Can you confirm if this behavior occurs on a specific web browser, like Safari with the "Open safe files after downloading" option enabled? Or is it specific to a Windows environment?
I'm only able to test this with a macOS machine at the moment, but I would like to confirm this detail with our engineers to see if this behavior is intended.
No, other browser don't unzip .tgz or tar.gz files automatically. I can confirm that if you download firebase tarball files from the archive with firefox or chrome they don't unzip and are still .tgz files (so they are still compressed which is good to save space)
I prefer to install packages directly via the manifest.json file in your Packages folder. you just add the lines referring to the files:
"com.google.external-dependency-manager": "file:../GooglePackages/com.google.external-dependency-manager-1.2.186.tgz",
"com.google.firebase.app": "file:../GooglePackages/com.google.firebase.app-13.6.0.tar",
"com.google.firebase.messaging": "file:../GooglePackages/com.google.firebase.messaging-13.6.0.tar"
(i could import the dependency manager as .tgz file but had to unzip the newer packages)
UPM (Unity package manager) does not need zipped (.tgz) files but can also handle archive (.tar) files, but it is standard to allow direct loading of zipped .tgz (aka tarball) files.
obviously UPM cannot read some of the zipped file which are provided in the archive as they have the wrong encoding (TAR_ENTRY_INVALID: invalid base256 encoding). I guess those files have been encoded using POSIX/GNU base-256 numeric fields which is a rather new format and default on MacOS. Unfortunately, Unity's package manager cannot handle this encoding, so currently on Windows or using browser who not auto-unzip you have to manually unizp these files to .tar files.
To sum up: some tarballs provided on the firebase archive (e.g. those with version number 13.6.0) have the wrong zip encoding to be readable by Unity when downloaded with browsers who do not unzip automatically. So there is an extra step needed to unzip the .tgz files to .tar to make them readable bei UPM.
You could improve the situations in three ways for your customers: a) provide the tarballs with the correct compression settings b) add a comment, that one has to unzip the files to (.tar) files to be readable by UPM (otherwise the (TAR_ENTRY_INVALID: invalid base256 encoding) Error will pop up
c) The best solution of course would be to make those tarballs accessible via git.url - which is really a strong wish by the community
all you have to do is to add some lines of code to your github action: https://github.com/marketplace/actions/unity-package-publish
Thanks for these details @dorn-gerhard. I've shared your suggestions with our engineers and we're actively discussing them. But we're curious about the browser you used, since we weren't able to successfully reproduce this behavior. I would appreciate it if you could also provide the following details to help point us in the right direction:
- Which browser(s) were you using when you encountered the issue? And which version(s)?
- Are you using any extensions (like download helpers, etc.)?
- Does disabling them or downloading a .tgz file from incognito help resolve the issue?
Hi @dorn-gerhard, I have some additional questions to the above.
- Can you confirm if you're also seeing this issue when you're using Google Chrome?
- And could you try downloading one of our tarball files using curl, then see if you encoutner issues there? You can check this sample code for your reference:
- curl https://dl.google.com/games/registry/unity/com.google.firebase.app/com.google.firebase.app-13.6.0.tgz -o com.google.firebase.app-13.6.0.tg
i used both browsers, Firefox (latest version = 146.0.1) and Chrome (143.0...) on Windows 11. I do not use any download helper.
if i download the file with Chrome or Curl both result in a file which seem to work with UPM With Firefox i only get the same file (96843 KB), when unzipping the firefox download (see screenshot)
Firefox seems to need an extra step for the latest .tgz files.
for the dependency manager https://dl.google.com/games/registry/unity/com.google.external-dependency-manager/com.google.external-dependency-manager-1.2.186.tgz
both browsers yield the same result