我的名為taskToFireOff 的處理程式已allUsers洗掉,Cloud Tasks Enqueuer主體名稱設定為ServiceAccountEmail,其角色設定為Invoker(未顯示)

創建帖子時,我使用它.onCreate來創建任務。任務已創建,但 http 請求連接到的函式從不觸發。我在這里查看
但是當我創建存盤桶時,我選擇了us-east1. 在 Firestore 資料庫的底部,它說
.
當我輸入時,$ gcloud app describe它說 locationId 是us-east1

問題可能是 Cloud Task 在,us-east1而 Cloud Functions 在us-central1?
運行$ gcloud functions list列出了我在該us-central1區域中的所有 Cloud Functions 函式

順便說一句,我創建了另一個專案只是為了查看我在創建存盤桶時給出的選擇。對于存盤,沒有辦法選擇 us-central1。有一個默認值Multi-region nam5(us-central) 但沒有特定區域us-central1。我選擇us-east1是因為我在紐約。
uj5u.com熱心網友回復:
問題是 App Engine 在,us-east1但函式處理程式taskToFireOff在us-central1. 錯誤是說與 App Engine/Cloud Task 關聯的函式需要一起位于同一區域。簡而言之,我需要更改該特定云函式的區域。
為了解決這個問題,我必須創建一個非常簡單的新處理程式。我遵循了這個答案,這讓我進入了這個鏈接,特別是更改函式的區域或區域部分。
1st- 在終端我跑了:
$ gcloud app describe
// use whatever appears for the locationId which for me was us-east1
2nd-我將這個新函式添加到 index.js 檔案中:
// whatever appeared for the locationId I put inside the region param
exports.newTaskToFireOff = functions.region('us-east1').https.onRequest((request, response) => {
// ... in here I c p all of the code from my initial taskToFireOff function
});
3rd-我在終端中運行它以使用新功能更新 gcloud
$ firebase deploy --only functions:newTaskToFireOff
4- 我在終端中運行它以從 gcloud 中洗掉舊函式:
$ firebase functions: delete taskToFireOff
5- 我進入我的 index.js 檔案并手動洗掉了整個taskToFireOff。你不需要舊函式,只需要它內部的代碼
// I deleted this old function
exports.taskToFireOff = functions.https.onRequest((request, response) => {
// ... I took this code and c p inside the newTaskToFireOff before I deleted this function
});
7號-
當我轉到控制臺的Cloud Functions 頁面時,舊的taskToFireOff不再存在,而newTaskToFireOff與該區域一起存在us-east1
完成這些步驟后,不要忘記步驟 2 中的新功能,您必須轉到云控制臺(使用上面的鏈接)并更改其Permissions. 將角色設定為Invoker并將其主體角色名稱設定為使用您為 Cloud Task 設定的任何內容,ServiceAccountEmail否則它仍然無法作業。你也應該洗掉allUsers。
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/318982.html
標籤:谷歌应用引擎 Firebase 实时数据库 谷歌云功能 云 谷歌云任务
上一篇:即使我在GoogleAppEngine中設定了{"type":"module"},“無法在模塊外使用匯入陳述句”錯誤
