"Invalid database id (default)" con Firestore Python (Admin SDK)

Open
#978 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Tech stack
firebase, google-cloud, python
Domain
databases

Research direction

Start by reproducing the error with firebase_admin.firestore.client() and google.cloud.firestore.Client(), using the reported firebase-admin and google-cloud-firestore versions. Compare the behavior with the default database ID and the documented alternatives, then inspect the relevant client-library entry points. Done means identifying a reproducible SDK or service cause and documenting a verified resolution or regression.

Written by the indexing model from the issue text.

Description

Ambiente

  • Progetto Firebase: misterapp-500516
  • Database Firestore: ID (default), edizione Standard, modalità Firestore nativo
  • Località database: eur3 (Belgio e Paesi Bassi, multi-regione UE)
  • Piano di fatturazione: Blaze
  • Ambiente di esecuzione: Streamlit Community Cloud (Python 3.14.7)
  • Librerie: firebase-admin (provate sia l'ultima versione disponibile sia fissata a 6.5.0), google-cloud-firestore==2.29.0

Errore

Alla chiamata di firestore.client() (o equivalentemente google.cloud.firestore.Client()), in scrittura su Firestore:

400 Invalid database id (default)

L'errore compare sia usando firebase_admin.firestore.client() senza specificare database_id, sia specificandolo esplicitamente come "(default)".

Cosa abbiamo verificato ed escluso

  1. Nome del database: confermato dalla Google Cloud Console (pagina Database, colonna "ID database") che è letteralmente (default), non un nome personalizzato.
  2. Valori alternativi provati per l'ID: "-default-" (visto nell'URL della Console) → errore diverso: "404 The database -default- does not exist for project misterapp-500516" (nonostante il database sia visibilmente presente e contenga dati). Anche database="" (esplicitamente vuoto, alternativa documentata) → stesso errore "Invalid database id (default)".
  3. Client utilizzato: stesso errore identico sia con firebase_admin.firestore.client() sia bypassando firebase_admin e usando direttamente google.cloud.firestore.Client(credentials=..., project=...).
  4. Credenziali/chiave dell'account di servizio: testate 4 chiavi diverse generate in momenti diversi (tutte validate sintatticamente e crittograficamente, RSA 2048 bit, caricate correttamente con la libreria cryptography). Stesso errore identico con tutte.
  5. Permessi IAM: l'account di servizio ha i ruoli Firebase Admin SDK Administrator Service Agent, Firebase Realtime Database Admin, Service Account Token Creator; aggiunto anche esplicitamente Cloud Datastore User. Nessun cambiamento.
  6. Versione della libreria: stesso errore sia con la versione più recente disponibile via pip, sia fissando firebase-admin==6.5.0 (marzo 2024).
  7. Codice applicativo: stesso errore anche tornando a una versione del codice precedente, con la connessione a Firestore nella sua forma più semplice (nessuna configurazione avanzata).

Nota

In precedenza (stessa chiave, stesso progetto, stesso codice base) i salvataggi su Firestore hanno funzionato correttamente per un periodo (dati confermati visibili nella collection). L'errore attuale è comparso senza una modifica di codice chiaramente collegabile, il che fa sospettare un problema lato servizio o una regressione libreria/infrastruttura piuttosto che un errore di configurazione del progetto.

Cosa funziona regolarmente

  • Lettura/scrittura sullo stesso progetto tramite Google Sheets API (libreria gspread) — nessun problema di credenziali o rete generale.
  • L'app resta pienamente funzionante usando Google Sheets come unico datastore.
Dominant language
Python
Stars
1.2k
Forks
359
Avg merge
5d 6m
Merged PRs (30d)
2

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from firebase/firebase-admin-python

All issues in firebase/firebase-admin-python

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.