GitHub ActionsFirebaseCI/CDESLintGCPTroubleshooting
GitHub Actions + Firebase 배포 삽질기 (403, ESLint, Secrets)
2026. 4. 21.3분 읽기
GitHub Actions + Firebase 배포 삽질기
프로젝트: TimeSlot Event OS 날짜: 2026-03-25 ~ 2026-03-26
문제 1 — w9jds/firebase-action 403 Forbidden
증상
Error: HTTP Error: 403, The caller does not have permission
GitHub Actions에서 w9jds/firebase-action을 사용해 배포하면 403 오류 발생.
원인
w9jds/firebase-action의 GCP 인증 방식이 최신 Google Cloud 정책과 충돌.
Service Account JSON을 GCP_SA_KEY로 넘기는 방식이 일부 프로젝트 설정에서 권한 거부.
해결
google-github-actions/auth@v2 (Google 공식 액션)으로 교체.
# Before
- uses: w9jds/firebase-action@master
with:
args: deploy --only hosting,functions
env:
GCP_SA_KEY: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
# After
- uses: google-github-actions/auth@v2
with:
credentials_json: ${{ secrets.FIREBASE_SERVICE_ACCOUNT }}
- run: npm install -g firebase-tools
- run: firebase deploy --only hosting,functions
핵심: 서드파티 Firebase 액션보다 Google 공식 Auth 액션 + Firebase CLI 직접 호출이 더 안정적.
문제 2 — 서비스 계정 권한 부족 (Cloud Billing API)
증상
Error: Service Usage API has not been used in project ... before or it is disabled.
구글 공식 액션으로 바꿔도 배포 실패.
원인
- 서비스 계정에
Service Usage Consumer역할 누락 - Cloud Billing API 미활성화
해결
Firebase 콘솔 → IAM → 서비스 계정 역할 추가:
Firebase AdminService Usage ConsumerCloud Build Service Account(선택)
GCP 콘솔 → API 및 서비스 → Cloud Billing API 활성화.
팁: 서비스 계정 생성 시 권한 체크리스트를 미리 검증하면 이 단계를 건너뛸 수 있다.
문제 3 — CI에서 npm run lint 실패
증상
sh: eslint: command not found
or
ESLint couldn't find a configuration file.
원인
functions/ 디렉토리에 .eslintrc.js 파일이 없었음.
해결
functions/.eslintrc.js 생성:
module.exports = {
env: { es6: true, node: true },
parserOptions: { ecmaVersion: 2020 },
extends: ["eslint:recommended"],
rules: {
"no-unused-vars": ["warn", { argsIgnorePattern: "^_" }],
"no-console": "off",
},
};
교훈: CI 파이프라인에 lint 스텝 추가 전에 로컬에서 npm run lint가 실제로 작동하는지 반드시 확인.
문제 4 — functions/.env 로그 마스킹
증상
CI 로그에 secrets 값이 그대로 출력될 위험.
해결
heredoc 대신 env 블록 + echo 방식으로 변경:
# Before (위험)
- run: |
cat <<EOF > functions/.env
SOLAPI_API_KEY=${{ secrets.SOLAPI_API_KEY }}
EOF
# After (안전 — GitHub이 자동 마스킹)
- name: Create .env
env:
SOLAPI_API_KEY: ${{ secrets.SOLAPI_API_KEY }}
run: echo "SOLAPI_API_KEY=$SOLAPI_API_KEY" >> functions/.env
환경변수 블록에 secret을 넣으면 GitHub Actions가 로그에서 자동으로 *** 마스킹 처리한다.
최종 결과
| 문제 | 원인 | 해결 |
|---|---|---|
| 403 Forbidden | 서드파티 action GCP 인증 실패 | google-github-actions/auth@v2 |
| Cloud Billing API 오류 | 서비스 계정 권한 누락 | IAM 역할 + API 활성화 |
| lint 실패 | .eslintrc.js 없음 | functions/.eslintrc.js 생성 |
| secrets 로그 노출 위험 | heredoc 방식 | env block + echo 방식 |