Clarification regarding APPLICATION_DEFAULT_CREDENTIALS
documentation
**Describe what scenario you think is uncovered by the existing examples/articles**
The documentation states that in environments which support ADC, you can create a Firestore instance via: `final firestore = Firestore();` Locally, I have exported `GOOGLE_APPLICATION_CREDENTIALS=/path/to/creds.json`, and my `server.dart` file consist of:
```
import 'package:google_cloud_firestore/google_cloud_firestore.dart';
final firestore = Firestore();
final docRef = firestore.collection('games').doc('foo');
final doc = await docRef.get();
...
```
but I still get:
```
"error": "Bad state: Project ID has not been discovered yet. Initialize the SDK with credentials that include a project ID, set project ID in Settings, or set the GOOGLE_CLOUD_PROJECT environment variable."
#0 Firestore.projectId (package:google_cloud_firestore/src/firestore.dart:344:5)
#1 DocumentReference._formattedName (package:google_cloud_firestore/src/reference/document_reference.dart:58:45)
#2 new _DocumentReader.<anonymous closure> (package:google_cloud_firestore/src/document_reader.dart:32:55)
#3 MappedListIterable.elementAt (dart:_internal/iterable.dart:442:31)
#4 ListIterable.toSet (dart:_internal/iterable.dart:229:18)
#5 new _DocumentReader (package:google_cloud_firestore/src/document_reader.dart:32:71)
#6 Firestore.getAll (package:google_cloud_firestore/src/firestore.dart:697:20)
#7 DocumentReference.get (package:google_cloud_firestore/src/reference/document_reference.dart:117:36)
```
In reviewing the stacktrace, it looks as though at no point does the sdk set the `Settings.project_id` before attempting to retrieve docs when using ADC. What am I missing?
**Describe why existing examples/articles do not cover this case**
Explain which examples/articles you have seen before making this request, and
why they did not help you with your problem.
**Additional context**
Add any other context or screenshots about the documentation request here.
5 条评论