firebase-tools getaddrinfo ENOTFOUND metadata.google.internal

I solved it simply by running :

firebase login

I also have this error when I don't have an internet connection.


the configuration has the wrong structure and lacks fields ...

admin.initializeApp({
    databaseURL: 'https://<DATABASE_NAME>.firebaseio.com',
    credential: admin.credential.cert({
        projectId: '<PROJECT_ID>',
        clientEmail: 'foo@<PROJECT_ID>.iam.gserviceaccount.com',
        privateKey: '-----BEGIN PRIVATE KEY-----\n<KEY>\n-----END PRIVATE KEY-----\n'
    })
});

you cannot just use the "web" configuration to access the Firebase Admin SDK.

because if this would be possible, the private key would be exposed to the public.

see the documentation.