- My goal: Using the Raw mode of retool to craft better request to my firestore database (for example only filtering in a field if a given input is non null
- Issue: The database name provided in the firestore ressource is ignored
- Steps I've taken to troubleshoot: I’ve tried adding the database name as suggested in Firebase Raw mode gives PERMISSION_DENIED after switching from (default) to named database — GUI mode works fine but it seems to have no effect
- Additional info:
- in GUI mode it works fine
- in Raw mode it clearly uses the "(default")” database (the data returned is wrond, and error messages for missing indexes point to the default database)
- Error can be seen on https://actinitiative.retool.com/ (only one app)
Summary
In Firestore Raw mode, the named database set on the Firebase resource is ignored — queries hit the "(default)" database instead (wrong data, missing-index errors point to default), even though GUI mode respects the configured named database.
AI Response
This is a known limitation: in Raw mode the Firebase client is initialized against "(default)" and does not pick up the database ID from the resource config, whereas GUI mode does. The workaround is to specify the target database explicitly in your raw-mode code via the firebase-admin SDK rather than relying on the resource setting — e.g. call getFirestore("your-database-name") (or pass the database name when obtaining the Firestore instance) so the client connects to the named database. Multiple community reports confirm this behavior and the SDK-based approach.
Sources
Firebase Raw mode gives PERMISSION_DENIED after switching from (default) to named database — GUI mode works fine
Corroborates the exact issue — several users confirm Raw mode initializes against "(default)" and ignores the resource's database ID, with staff suggesting you pass the desired database name when calling firestore via the firebase-admin SDK.
Support for Firestore multiple databases - connect to database besides default
Documents the underlying limitation and provides the concrete SDK syntax for targeting a non-default database, e.g. getFirestore("otherdb").
The Community Team is testing out a new automation. Let us know if it's helpful (or not) by leaving a
,
, or
. Or by marking this post as the "Solution"! Let us know if you have any feedback here. ![]()
I’ve tried
getFirestore("your-database-name")
and
app.getFirestore("your-database-name")
And both return errors (as neither app, nor getFirestore are defined).
And
db.firestore("your-database-name")
Does not work either, it does not return an error but the database name is ignored.
In the end I abandonned the classic app and rebuilt it with the new App builder and this works correctly.
Hi @jamestpacker, thanks for following up with what worked! Rebuilding in the new app builder is a good fix, and it'll help anyone who lands on this thread later.
For anyone hitting the same thing: it looks like Raw mode in classic apps doesn't use the database ID set on the Firestore resource. It queries the (default) database instead, and getFirestore() isn't available there, so the suggestion in the earlier automated reply won't work.
Two workarounds in the meantime:
- Classic apps: use GUI mode, which respects the database ID on the resource.
- New app builder: Raw queries use the configured database, as you found.
If more people need Raw mode against a named database in classic apps, we'll take a closer look. Thanks again for sharing what you found!