node.js - การปรับใช้ฟังก์ชัน Firebase: ข้อมูลสภาพแวดล้อมที่ไม่กำหนดด้วย Github actions
ฉันกำลังพยายามตั้งค่า GITHUB actions เพื่อปรับใช้ฟังก์ชัน Firebase ของฉัน โค้ดของ action คือ:
name: Development Deploy Workflow
'on':
push:
branches:
- develop
jobs:
backend-deployment:
name: Backend Development Deployment
runs-on: ubuntu-latest
steps:
- name: Checkout GitHub repository
uses: actions/checkout@v2
- name: Install dependencies
run: npm install
- name: Deploy to Firebase Functions
uses: w9jds/firebase-action@master
with:
args: deploy -P development --only functions
env:
GCP_SA_KEY: '${{ secrets.GCP_SA_KEY }}'
เมื่อการกระทำทำงาน ฉันได้รับข้อผิดพลาดนี้:
✔ functions: Finished running predeploy script.
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
✔ functions: required API cloudbuild.googleapis.com is enabled
✔ functions: required API cloudfunctions.googleapis.com is enabled
Error: Error occurred while parsing your function triggers.
TypeError: Cannot read property 'private_key' of undefined
at Object.<anonymous> (/github/workspace/lib/services/Firebase.service.js:29:47)
บรรทัดที่มีรหัสคือ:
const { private_key } = functions.config().service_account
ฉันไม่เข้าใจว่าทำไม functions.config() ถึงว่างเปล่า เพราะฉันสามารถดีพลอยฟังก์ชันของฉันจากเครื่องคอมพิวเตอร์ของฉันได้โดยไม่มีปัญหาและในสามสภาพแวดล้อมที่แตกต่างกัน มีใครสามารถช่วยฉันได้ไหม? ขอบคุณล่วงหน้า