-
Notifications
You must be signed in to change notification settings - Fork 595
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
Auth does not correctly use emulator in 29.2.1+ including 30.0.0, works in 29.1.0 #3557
Comments
I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight. |
Tracking internally at b/225972666. |
Hi @mikehardy -- I tried testing with the Android quickstart built with BoM version 29.2.1 and was unable to reproduce this issue. If you create a user with an email that is neither in the emulator database nor the prod database, where does the user appear? |
Oh, that's unexpected, I did double-check my environment prior to filing but obviously it needs a really careful triple check, thanks for the attempt and I'll let you know. Sorry for logging something that wasn't clear cut! |
I began pursuing this again yesterday after handling some iOS items, and I still reproduce this locally. 29.1.0 works perfectly in my testing, simply switching to 29.2.1 it starts to fail. Why is of course the open question and react-native-firebase may be the source of some really subtle error but it is quite odd that simply switching the dependency immediately causes the error, if it's in react-native-firebase. |
Hmm I'll dig into this further. In the meantime, a quick question -- in manual testing for the |
@rosalyntan sorry for the delay answering your question and thanks for your patience.
Here's the temporary additions I made: @ReactMethod
public void useEmulator(String appName, String host, int port) {
Log.d(TAG, "useEmulator");
Log.d(TAG, "useEmulator temp log - appName: " + appName);
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp);
Log.d(TAG, "useEmulator temp log - host: " + host);
Log.d(TAG, "useEmulator temp log - port: " + port);
firebaseAuth.useEmulator(host, port);
Log.d(TAG, "useEmulator temp log - after call, so, no exception...");
} Here's the interesting bits from logcat:
I had a hunch perhaps it was an async issue so I tried adding a main thread sleep after the useEmulator firebase-android-sdk call: @ReactMethod
public void useEmulator(String appName, String host, int port) {
Log.d(TAG, "useEmulator");
Log.d(TAG, "useEmulator temp log - appName: " + appName);
FirebaseApp firebaseApp = FirebaseApp.getInstance(appName);
FirebaseAuth firebaseAuth = FirebaseAuth.getInstance(firebaseApp);
Log.d(TAG, "useEmulator temp log - host: " + host);
Log.d(TAG, "useEmulator temp log - port: " + port);
firebaseAuth.useEmulator(host, port);
try { Thread.currentThread().sleep(5000); } catch (Exception e) { /* ignore interruptions */ } // <--- added this
Log.d(TAG, "useEmulator temp log - after call and sleep, so, no exception...");
} No behavior change except 5 more seconds pass:
The auth module here is not open source, so I can't pursue it further. All I know is that even if I give a useEmulator call verified correct arguments, and give it ample time to execute (in case it is async) it simply is not taking effect, and I don't know why. It works perfectly with bom 29.1.0, fails on 29.2.0 and 29.2.1 |
Just in case you have a local environment with node v16+ installed and Believe it or not, it's actually not too bad to set up, maybe just the work of 10 minutes or so, then you'll have a reproduction. This branch is configured to do exactly that, and includes my temporary log statements: https://github.com/invertase/react-native-firebase/tree/%40mikehardy/dependency-updates |
Hi @mikehardy -- I tried setting up an environment to run the React Native e2e tests, and am running into some trouble. After running
Is the Firestore emulator necessary for the Android tests to run? I also got an error when running On a separate note, Firebase Android 29.3.0 was released on March 24 -- can you check to see if that fixes anything? I'm not confident it will make a difference, but it's worth a shot. |
I have seen that error before but couldn't reproduce, i wonder if it's an assumption about cwd for the yarn script execution? I think this is something different regardless if you alter the auth e2e to be describe.only it won't run the functions test so those helpers will be skipped This is all about the emulator connection though so if emulator startup had an issue it may be important to solve it I'll see if I can reproduce this sample data thing and I will test the new SDK release I appreciate the effort to get the rnfb e2e rig working, sorry it wasn't seemless, it's supposed to be a good new contribution experience so I'll do my best to iron it out |
I checked out react-native-firebase, specifically on the branch mkdir temp
cd temp
git clone [email protected]:invertase/react-native-firebase
cd react-native-firebase
git checkout @mikehardy/dependency-updates
yarn
yarn tests:andoid:build
yarn tests:emulator:start // <-- this consumes the Terminal, so open another terminal and cd into react-native-firebase dir
yarn tests:packager:jet // <-- consumes the Terminal, open new Terminal cd into react-native-firebase dir
adb reverse tcp:8081 tcp:8081 // <-- may not be necessary? I need it for android31 emulator, but react-native should handle it
yarn tests:android:test of course worked just means I reproduced the error, but...that all worked for me as documented 🤔 I also tried firebase-android-sdk 29.3.0 and it is not correctly using the auth emulator either (double 🤔 ) Our CI script is perhaps a separate way of completely specifying exactly how we run the e2e setup (successfully) since all versions of everything are available via reference or direct specification, and all steps are explicitly listed: https://github.com/invertase/react-native-firebase/blob/main/.github/workflows/tests_e2e_android.yml |
Oh! I finally connected the dots. Your emulator startup failure is linked to the test execution failure. The emulator-functions build before firebase emulator startup: The typescript compile, run by that build: The sample data that should then be compiled (via tsc) from src to lib: So, something about that isn't working but not sure what. Also, if the An alternative way to "focus" the testing down to just auth and remove reference to functions at all is to edit this file and comment out all the e2e test directory entries except the one for auth: |
Hi @mikehardy -- a fix for this issue should be included in the next release. Please re-open this issue if you still experience this! |
Wait wait! You mean you reproduced it :-)! Because I was literally just starting to lay issue reproduction tools out on the workbench last evening and was going to take it up again this evening. I definitely still see it now but of course you haven't had a release yet, so that makes sense if you just fixed. Great news! This has been vexing me as it stops us from moving up to releases that include a firestore offline/online reconnection issue. Thanks @rosalyntan |
@rosalyntan with sincere apologies, I just pulled firebase-android-sdk 30.0.0 and this is still an issue. When you said the next release I assumed 30.0.0 but perhaps that is not accurate and the commit didn't make release branch cut or similar? If the reproduction is not adequate or there is anything else I can do to move this forward let me know - would love to get firebase-android-sdk 30 landed for Google I/O Edit to add my focused reproduction test branch is updated to latest SDK https://github.com/invertase/react-native-firebase/tree/%40mikehardy/dependency-updates |
Fixes #6158 until we can use a newer firebase-android-sdk See firebase/firebase-android-sdk#3557
Hi @mikehardy -- thank you for the update! Turns out that Firebase Auth was accidentally excluded from the 30.0.0 release. I'm working with the release team to get a new BoM version out that will have the new Firebase Auth version with the fix and will update here when it is published. |
I have to tell you, that's a relief, I am starting to doubt myself here on ability to test or reproduce anything 😅 |
Fixes #6158 until we can use a newer firebase-android-sdk See firebase/firebase-android-sdk#3557
Hi @mikehardy -- the Firebase BoM 30.0.1 was published this morning and should contain the auth fix 🤞 Please let me know if there are any more issues! |
@rosalyntan It is a thing of beauty!
Thank you! |
[READ] Step 1: Are you in the right place?
Issues filed here should be about bugs in the code in this repository.
If you have a general question, need help debugging, or fall into some
other category use one of these other channels:
with the firebase tag.
google group.
of the above categories, reach out to the personalized
Firebase support channel.
[REQUIRED] Step 2: Describe your environment
[REQUIRED] Step 3: Describe the problem
Steps to reproduce:
Should work, does work in 29.1.0, 29.2.1 does not appear to actually use the auth emulator though. You get "email in use" error
Relevant Code:
I think the steps to reproduce should be quick enough to reproduce, but you can see the whole app that reproduces it in the react-native-firebase android tests app we use for e2e testing our exposure of all the APIs in your SDK here:
Full app so you may see dependencies etc:
https://github.com/invertase/react-native-firebase/tree/%40mikehardy/dependency-updates/tests/android
our useEmulator call
https://github.com/invertase/react-native-firebase/blob/8406336415511ce58d1611f94106cceaf920567e/packages/auth/android/src/main/java/io/invertase/firebase/auth/ReactNativeFirebaseAuthModule.java#L1562-L1567
The line that fails:
https://github.com/invertase/react-native-firebase/blob/8406336415511ce58d1611f94106cceaf920567e/packages/auth/e2e/auth.e2e.js#L29
The text was updated successfully, but these errors were encountered: