[英]GCP Cloud Function not mounting latest secret from Secret Manager
[英]What is the Correct Way to Use Secret Manager in Firebase Cloud Function?
我開始使用 Node.js 添加帶有 SECRET_NAME 的 Secret Manager,其中包含雲 Function 中的特定密碼。我嘗試了兩種方法。 首先,使用控制台添加 Secret Manager,然后通過 Firebase CLI 直接添加 Secret Manager。 不幸的是,這兩種方式都在 Secret 的 Cloud Function 變量中給出了一個空的 Secret 值,如下圖所示。
我使用參數 runWith({secret: ["SECRET_NAME"]}) 如下代碼所示。
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, };
我遵循了 Firebase Cloud Function ( https://firebase.google.com/docs/functions/config-env ) 中編寫的文檔。
我浪費了將近一個星期的時間來找出我哪里錯了,但一無所獲。 我還在 Google Cloud Console 中為當前的 SECRET_NAME 添加了一個角色“Secret Manager Secret Accessor”,但結果一無所獲。 正如這個 stackoverflow 帖子參考中所寫
我的問題是我應該在 Google Cloud Platform 的 Cloud Function 控制台中手動添加 SECRET_NAME 嗎? 如果是這樣,那么上面寫的文檔有什么用呢? Firebase 是想把我們引向無路可走嗎?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.