Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

288
Visualizações
Must we manually log errors in Firebase Cloud Functions or will they log automatically?

I have this cloud function currently deployed. It returns a promise as required by Firebase to terminate the function.

exports.userDidSignOut = functions.https.onCall((data) => {
    const userId = data.userId;
    const settingsUpdate = {
        "fcmToken": null,
    };
    const promise = admin.firestore().collection("user-settings").doc(userId).update(settingsUpdate);

    return promise
});

However, will this log errors on the console automatically? Or must I log them manually (as below)?

exports.userDidSignOut = functions.https.onCall((data) => {
    const userId = data.userId;
    const settingsUpdate = {
        "fcmToken": null,
    };
    const promise = admin.firestore().collection("user-settings").doc(userId).update(settingsUpdate);

    promise.then(() => {
        return null;
    }, (reason) => {
        console.log(reason);
        return null;
    });
});

And is it necessary to return null in the failure function to terminate the cloud function or is printing to the console sufficient?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

There's an entire documentation page on handling errors in Cloud Functions. From there:

Uncaught exceptions produced by your function will appear in Error Reporting.

So you don't have to do this yourself, although you can of course always do so to add additional context around the error.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda