Skip to content

Database emulator + App Check on Android (firebase-android-sdk + react-native-firebase) hangs #3663

Closed
@mikehardy

Description

@mikehardy

[REQUIRED] Environment info

firebase-tools: 9.23.1

Platform: macOS 11.6.1

[REQUIRED] Test case

With apologies, it is not that easy to provide a minimal complete example of App Check on Android causing the database emulator to hang. At least the minimal part. But please bear with me, I'm the maintainer of react-native-firebase so we have a fully reproducible end-to-end test harness that shows this.

I've prepared a branch in our repository that is fairly focused so reproduction is quick:

https://github.com/invertase/react-native-firebase/tree/%40mikehardy/appcheck-android-database-emu-hang

To set things up you want to clone that, then follow the steps in our test harness README - https://github.com/invertase/react-native-firebase/blob/master/tests/README.md

(they boil down to: yarn, yarn tests:android:build, create an android emulator called "TestingAVD" and start it, yarn tests:emulator:start to start the firebase emulator, yarn tests:packager:jet to start our test bundler then you are ready)

[REQUIRED] Steps to reproduce

After doing the above things, run yarn tests:android:test, it will start our e2e harness but I've boiled it down to just app-check running then the database tests. It will fail almost immediately - just hanging the first time it tries to hit the database emulator (to do a server increment, for what it's worth, but it fails on all access that I saw?)

[REQUIRED] Expected behavior

It rolls right through the database tests like it used to
it pass all tests if you comment line 47 of tests/app.js (so it goes against live database).

Note that if you do yarn tests:ios:pod:install (assuming you have cocoapods installed?) and then yarn tests:ios:build and yarn tests:ios:test, iOS + app check + database emulator has no problem.

Seems android specific. Javascript is untested.

[REQUIRED] Actual behavior

Hangs on first attempt to access database emulator after including app check library.


[2021-08-11T20:13:10.206Z] 15:13:10.205 [FirebaseWorkerPool-1-3:react-native-firebase-testing$553253896:] WARN com.firebase.server.realtime.RealtimeClient - ClientId[1]:ErrorId[1]: Error on incoming message. (JsonMappingException) Failed to parseMessage: '{"t":"d","d":{"a":"appcheck","r":1,"b":{"token":"eyJraWQiOiJmQjdFNnciLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiIxOjQ0ODYxODU3ODEwMTphbmRyb2lkOmNjNmMxZGM3YTY1Y2M4M2MiLCJhdWQiOlsicHJvamVjdHNcLzQ0ODYxODU3ODEwMSIsInByb2plY3RzXC9yZWFjdC1uYXRpdmUtZmlyZWJhc2UtdGVzdGluZyJdLCJpc3MiOiJodHRwczpcL1wvZmlyZWJhc2VhcHBjaGVjay5nb29nbGVhcGlzLmNvbVwvNDQ4NjE4NTc4MTAxIiwiZXhwIjoxNjI4NzE1NTEwLCJpYXQiOjE2Mjg3MTE5MTB9.iiBA6aO1_6auvr1sipvjfsWUIDwqUHsLkKUHugxMNb1YF4Uyf1b5UMxTA3nIGCllqMssKJ8taeh_bWqkmtc91B38_DZBilVnQb-NHl2-qQcwhqjkgN2p7ztX79OP3JVY5XWZtOhSazoeWE2yM67XA2mQGH62O-KZRExJUHych5kPZKCIFPucA0h7soeGIMW6bsF8KFi2cQNk9D7E874wf-0WSwuPgnXv1cyyuFq6S25-s58XWvpN6jCXe7NySEExXhkTtXJo0eLFYgIHun0mjFZvTeaxOrDz1hZWc02N3-2bDvq3sAVT81rmF8QZgBsSOiMBDGmnb8Ay2qFYD4BUIp9_I4l4HjhrYZirG1ZLSjQBWUgme02Byj8ZwUxQM0McYMF-uKvrs54JJ_7MpM6p22SG4TMsPNNCk9EyFazSQ_OJkgPIv7-B9RQBaJ25W_vS2VQeAf-F_2qc5cesc-HVh3GaV8qCchCWxZEZLkLYTNcN4uQCEI22GsGbLJjmhkJf"}}}'
 at [Source: (io.netty.buffer.ByteBufInputStream); line: 1, column: 918] Namespace:react-native-firebase-testing
 {"metadata":{"emulator":{"name":"database"},"message":"15:13:10.205 [FirebaseWorkerPool-1-3:react-native-firebase-testing$553253896:] WARN com.firebase.server.realtime.RealtimeClient - ClientId[1]:ErrorId[1]: Error on incoming message. (JsonMappingException) Failed to parseMessage: '{\"t\":\"d\",\"d\":{\"a\":\"appcheck\",\"r\":1,\"b\":{\"token\":\"eyJraWQiOiJmQjdFNnciLCJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiJ9.eyJzdWIiOiIxOjQ0ODYxODU3ODEwMTphbmRyb2lkOmNjNmMxZGM3YTY1Y2M4M2MiLCJhdWQiOlsicHJvamVjdHNcLzQ0ODYxODU3ODEwMSIsInByb2plY3RzXC9yZWFjdC1uYXRpdmUtZmlyZWJhc2UtdGVzdGluZyJdLCJpc3MiOiJodHRwczpcL1wvZmlyZWJhc2VhcHBjaGVjay5nb29nbGVhcGlzLmNvbVwvNDQ4NjE4NTc4MTAxIiwiZXhwIjoxNjI4NzE1NTEwLCJpYXQiOjE2Mjg3MTE5MTB9.iiBA6aO1_6auvr1sipvjfsWUIDwqUHsLkKUHugxMNb1YF4Uyf1b5UMxTA3nIGCllqMssKJ8taeh_bWqkmtc91B38_DZBilVnQb-NHl2-qQcwhqjkgN2p7ztX79OP3JVY5XWZtOhSazoeWE2yM67XA2mQGH62O-KZRExJUHych5kPZKCIFPucA0h7soeGIMW6bsF8KFi2cQNk9D7E874wf-0WSwuPgnXv1cyyuFq6S25-s58XWvpN6jCXe7NySEExXhkTtXJo0eLFYgIHun0mjFZvTeaxOrDz1hZWc02N3-2bDvq3sAVT81rmF8QZgBsSOiMBDGmnb8Ay2qFYD4BUIp9_I4l4HjhrYZirG1ZLSjQBWUgme02Byj8ZwUxQM0McYMF-uKvrs54JJ_7MpM6p22SG4TMsPNNCk9EyFazSQ_OJkgPIv7-B9RQBaJ25W_vS2VQeAf-F_2qc5cesc-HVh3GaV8qCchCWxZEZLkLYTNcN4uQCEI22GsGbLJjmhkJf\"}}}'\n at [Source: (io.netty.buffer.ByteBufInputStream); line: 1, column: 918] Namespace:react-native-firebase-testing\n"}}

I'd be happy to collaborate if there's anything I can do to help put a spotlight on this but (despite the size of our e2e test suite when considered as a "reproducible example") I think this repro is about as clean as I can make it

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions