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

460
Views
What is the Correct Way to Use Secret Manager in Firebase Cloud Function?

I started to add Secret Manager with a SECRET_NAME contains a certain password inside Cloud Function using Node.js. I tried both ways. First, adding Secret Manager using Console and another, adding Secret Manager directly through Firebase CLI. Unfortunately, both ways give an empty Secret value in Cloud Function variable of Secret as shown in picture below.
Link to the picture

I used parameter runWith({secret: ["SECRET_NAME"]}) as shown in code below.

exports.Auth = functions.runWith(secret).https.onCall(async (data, context) => {
  const response = 129132;
  return Promise.resolve(response);
});

const secret = {
  timeoutSeconds: 120,
  memory: "1GB",
  secret: ["SECRET_NAME"],
  minInstances: 0,
};

I followed the documentation written in Firebase Cloud Function (https://firebase.google.com/docs/functions/config-env).

I had wasted almost a week to figure out where I got wrong and found nothing. I also added a role "Secret Manager Secret Accessor" to current SECRET_NAME in Google Cloud Console, and it gave result to nothing at all. As written in this stackoverflow post reference

My question is should I add SECRET_NAME manually in Cloud Function Console in Google Cloud Platform? If so, then what is the use of documentation written above? Is Firebase trying to lead us to nowhere?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I am sorry guys.
Apparently, I was wrong in writing the code:

const secret = {
  timeoutSeconds: 120,
  memory: "1GB",
  secrets: ["SECRET_NAME"], //Must use secrets not secret
  minInstances: 0,
};
enter image description here

Thank you, @MichaelBleigh.
Problem is now solved.

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!