Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!