# Google cloud platform ## 誤刪 default compute service account: 30 天內用 gcloud 加回來 ``` gcloud iam service-accounts undelete "115754855009870202382" --project=play-and-swim ``` >https://cloud.google.com/compute/docs/troubleshooting/troubleshooting-default-service-accounts ## Cloud run 監聽偵測 Storage bucket 並 log 印出 function: ``` const functions = require('@google-cloud/functions-framework'); // CloudEvent callback that will be triggered by Cloud Storage. functions.cloudEvent('students', cloudEvent => { const file = cloudEvent.data; // 檢查文件類型是否為 CSV if (file && file.name.endsWith('.csv')) { console.log(`新上傳的 CSV 檔案名稱: ${file.name}`); } else { console.log("未檢測到新上傳的 CSV 文件或文件類型不符"); } }); ``` Log: ![Screenshot 2024-10-26 at 3.56.58 PM](https://hackmd.io/_uploads/HyPReX9xJe.png)