question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Incorrect namespace when using database emulator

See original GitHub issue

production database URL looks like this: https://chat-2df58.firebaseio.com

emulated database URL looks like this: http://10.0.2.2:9000?ns=chat-2df58

When I initialize the database using this method: FirebaseDatabase.getInstance('<database_url>');

Namespace is parsed from the URL as a substring from the beginning to the first dot. It works correctly with the production URL, the namespace will be chat-2df58. But if you want to connect to a database emulator, the namespace will be 10 which is completly wrong.

And because of this you cannot fetch the data in the right way: http://localhost:9000/.json?ns=chat-2df58

Instead you must use following url: http://localhost:9000/.json?ns=10

Expected behavior: If the ns url parameter is present, use it as a namespace. If not, parse namespace from the begginning of the URL to the first dot.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
kroikiecommented, Jul 9, 2020

@anton9088-new The firebase_database and other plugins are in the process of being updated to use the latest versions of the Android SDKs. Sorry for the delay on this, we are working on it.

0reactions
rlazocommented, Jan 10, 2021

The dep should be up to date now. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

firebase - Not able to use realtime local emulator database
I see the realtime Database in green and can see the empty DB. But from there, I am not able to do anything...
Read more >
firebase::database Namespace
A DataSnapshot instance contains data from a Firebase Database location. firebase::database::Database ... You specified an invalid Variant type for a field.
Read more >
Configure a connection string - Azure Storage - Microsoft Learn
The easiest way to connect to the emulator from your application is to configure a connection string in your application's configuration ...
Read more >
AAPT2 - Android Developers
Additionally, if you incorrectly include the symbol when accessing a resource from the android namespace: ... <!-- When referencing resources ...
Read more >
The Local Firebase Emulator UI in 15 minutes - YouTube
The Firebase emulator suite fundamentally changes how you build on Firebase by making it possible to run services locally on your machine.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found