nodejs-firestore
nodejs-firestore copied to clipboard
When no credentials are available, firestore call never returns.
I expect it to return an error code, but instead the call never returns. Here's the code.
import admin from 'firebase-admin';
admin.initializeApp({
credential: admin.credential.applicationDefault(),
});
await db.collection('hello').doc('world').get(),
Hey @SurferJeffAtGoogle
Thanks for the report. I tried to reproduce with below snippet but failed.
import admin from 'firebase-admin';
const app = admin.initializeApp({
credential: admin.credential.applicationDefault(),
});
async function test() {
const db = app.firestore();
const snap = await db.collection('hello').doc('world').get();
console.log(`${snap.data()}`);
}
test();
Can you provide a bit more info to reproduce this?
@wu-hui how did it fail? It wasn't top-level await missing was it? I would expect test() to be awaited?
It failed to reproduce the hang. test()
runs and returns, with undefined
printed to the console.
@SurferJeffAtGoogle mentioned in our chat that this happens in a test in Github Actions, so this might be something else. I have not tried yet.
@SurferJeffAtGoogle Is this issue resolved? I tried with GA, and it looks like it is working fine, with my snippet.
If you still have issues, can you try to run it outside of GA, and can you share the full snippet with me?
Thanks
I have a work-around. It may be the environment the github action runs in. What does the client do if the server accepts the connection but never sends bytes on the socket?
To reproduce, try instantiating the client in a docker container with the network turned off.
With the script:
const admin = require('firebase-admin');
const app = admin.initializeApp({
credential: admin.credential.applicationDefault(),
});
async function test() {
const db = app.firestore();
const snap = await db.collection('hello').doc('world').get();
console.log(`${snap.data()}`);
}
test();
With Wifi on it immediately prints undefined
. With Wifi off it hangs for a while and then throws the error Error: 14 UNAVAILABLE: Name resolution failed for target dns:firestore.googleapis.com:443
after 41 seconds for me.