-
Notifications
You must be signed in to change notification settings - Fork 902
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
cloud-storage-rules-runtime crashes due to missing com/ibm/icu/text/UTF16$StringComparator #3481
Comments
@ronba thanks for the detailed report and the workaround! This class comes from the icu4j library which should be included in our |
Hey there, to add some context here, we are really aggressive about stripping unused code from our java jars, so we were just overly aggressive and stripped out something we needed. I'll take a look and see about white listing this. Thanks for the report. |
The issue is still there (aggressively stripping libraries) when using this rule:
Throws similar exception:
CLI Version 9.21.0 and 9.22.0 |
Hi, Issue is still there (on CLI 10.0.1 - MacOS) with this set of rules:
|
@sikado not sure if helpful but while waiting for the fix I've been working around this by:
Then I used patch-package to get the patch installed. If you install firebase-tools to the root of the project you'll need to either use npx to call firebase emulators (so npx firebase emulators ...) or call it from node_modules/.bin/firebase. (a):
|
My apologies if this is not the right repository to file this in.
It looks like cloud-storage-rules-runtime isn't part of this repository but is being invoked by downloadableEmulators.ts.
[REQUIRED] Environment info
firebase-tools: 9.12.1
Platform: macOS
[REQUIRED] Test case
Create the following files:
Create a test file (this is the easiest way I've found to reproduce this so far), test.ts:
storage.rules:
[REQUIRED] Steps to reproduce
[REQUIRED] Expected behavior
The test completes without the storage emulator crashing.
[REQUIRED] Actual behavior
The storage emulator crashes with the following exception is thrown:
Workaround:
Not really a workaround but for now I manually added com/ibm/icu/text/UTF16$StringComparator to the java class path using these steps:
Download the jar containing java.lang.NoClassDefFoundError: com/ibm/icu/text/UTF16$StringComparator, for example: https://mvnrepository.com/artifact/com.ibm.icu/icu4j/69.1
Place it in a library that's easily accessible, for example $HOME/jars/
Open downloadableEmulators.js from firebase-tools, it should be here: node_modules/firebase-tools/lib/emulator/downloadableEmulators.js
Find the entry for storage
Edit it so it looks like:
storage: {
binary: "java",
args: [
"-classpath",
`$DIRECTORY_FROM_STEP_1/icu4j-69.1.jar:${getExecPath(types_1.Emulators.STORAGE)}`,
"-Duser.language=en",
"com.google.firebase.rules.tools.local.FirebaseRulesTooling",
"serve",
],
...
Run the emulator
The text was updated successfully, but these errors were encountered: