Open tzappia opened 7 months ago
Hi @tzappia. Thank you for reporting this issue. I'm able to reproduce it and I can see how it would be a nuisance.
Here are the steps that I followed:
firestore_export_data.zip
to a directory on your local computer.firebase emulators:start --only firestore --import 2024-04-19T16:22:17_20757
(the path to --import
is the directory that was created upon extracting the zip file).EmulatorImportIssue8166
.Expected Results: No warnings are logged.
Actual Results:
The following warning is logged to the console: Document EmulatorImportIssue8166/DocA contains a document reference within a different database (dconeybe-testing/(default)) which is not supported. It will be treated as a reference in the current database (foo-bar-baz/(default)) instead.
Here is some sample code to run the query:
const db = getFirestore();
const collectionRef = collection(db, "EmulatorImportIssue8166");
const snapshot = await getDocs(collectionRef);
for (const documentSnapshot of snapshot.docs) {
console.log(`Document: ${documentSnapshot.id}: ${JSON.stringify(documentSnapshot.data())}`);
}
Attachments:
I've logged b/335854401 to track this request internally. Note, however, that I can't make any promises as to if or when we will fix this. But we will reply back if there is any progress.
This is a much bigger issue for restored databases.
Steps to reproduce:
foo
authors/paolini
:
books/eragon
:
databases/foo/documents/authors/paolini
bar
from the backup:
https://cloud.google.com/firestore/docs/reference/rest/v1/projects.databases/restorequery(barDb, collection(barDb, 'books'), where('author', '==', doc(barDb, 'authors/paolini')))
This makes it almost impossible to restore a database and immediately use it.
Operating System
macOS 14.4.1
Browser Version
Chrome/123.0.6312.124
Firebase SDK Version
10.11.0
Firebase SDK Product:
Firestore
Describe your project's tooling
Angular 17 app
Describe the problem
When using imported production data in a dev environment with an app using the Firebase emulators, I get the following error in the browser JavaScript console:
@firebase/firestore: Firestore (10.11.0): Document users/<documentId> contains a document reference within a different database (<databaseName>/(default)) which is not supported. It will be treated as a reference in the current database (demo-project/(default)) instead.
This appears to have no functional impact (I looked at the source Firebase code and the only action taken for this reference check is to log an error.) When loading a page with a long list of documents, this causes my Chrome JavaScript console to grind to a halt and become pretty unresponsive (there are many, many instances of this error log.)
Since this is more informational than an actual error, ideally this log would just be removed and be covered in documentation if necessary. In addition, if there are any tips for importing production data an an emulated environment and having all document references converted appropriately, I'd be happy to learn about it!
There is a comment in the code where the error is logged
// TODO(b/64130202): Somehow support foreign references.
but this bug report is about the error log and not asking for support for foreign references.Steps and code to reproduce issue
--import
flag.