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

153
Visualizações
Google Cloud Functions - permission-denied vs failed-precondition

Which HTTPs error type should I use when checking that the auth id is present?

const userId = context.auth.token.uid;

if (!userId) {
  throw new functions.https.HttpsError(
    "failed-precondition",
    "Authentication required."
  );
}

or

const userId = context.auth.token.uid;

if (!userId) {
  throw new functions.https.HttpsError(
    "permission-denied",
    "Authentication required."
  );
}
about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Actually you can choose the error type you prefer among the list of available error types. As a matter of fact, this error code is going to be sent back to your front-end, which you normally control.

Now, looking at the list of error codes...

permission-denied: The caller does not have permission to execute the specified operation.

failed-precondition: Operation was rejected because the system is not in a state required for the operation's execution.

... I would choose permission-denied.

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