chore(functions): Firebase 依存更新 / Node 22 ランタイム / firebase-tools 除去 - #42
Conversation
…ase-tools Modernize Cloud Functions dependencies while keeping the Gen1 (v1) trigger model (Gen2/Node 24 would require rewriting auth.user() triggers; out of scope). - engines.node 18 -> 22 (Gen1 max; Node 24 is Gen2-only). - firebase-admin ^10 -> ^13.10, firebase-functions ^4 -> ^6.6 (v1 namespace retained; verified module loads and tsc type-checks). - Replace internal deep imports that break on the new majors with public subpaths: firebase-functions/v1, /v1/firestore, /v1/storage, /v1/auth. - Pin @types/node to 22.x (Node 18 types were incompatible with TS 5.9's generic typed-array lib). - Bump axios, ws, rxjs, @slack/web-api, typescript 5.9, eslint 8.57, @typescript-eslint 8, prettier 3, firebase-functions-test 3. - Remove firebase-tools from functions devDeps (CLI not needed here; was the main source of high/critical advisories). Deploy uses root-level firebase CLI. - overrides: crypto-js 4.2.0 (merkletreejs pulled vulnerable 3.3.0), axios ^1.17.0 (old bundled axios in the OpenAPI client), bn.js 5.2.3. Deterministic hashing outputs preserved; testnet deploy is the integration check. Result: npm audit high/critical 80 -> 0. 9 moderate advisories remain, all in the firebase-admin/firebase-functions Google networking stack (gaxios, teeny-request, retry-request, uuid) pinned by the latest upstream releases; force-overriding them risks breaking the backend, so they are left for upstream / Dependabot. CI gate is set at --audit-level=high. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Pull request overview
Cloud Functions(Gen1/v1 トリガー維持)の依存更新と import 経路整理を行い、ランタイム更新も含めて保守性/セキュリティ改善を狙うPRです。
Changes:
firebase-functionsv6 系に合わせて、内部 deep import を公開サブパス(firebase-functions/v1/*)へ置換- Functions 側の主要依存(
firebase-admin/firebase-functions/ TypeScript / ESLint 等)を更新 functions/package.jsonの Node エンジン指定を更新し、依存の override を追加
Reviewed changes
Copilot reviewed 36 out of 37 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| functions/src/v1/storage/admin/user/file/index.ts | Storage v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/pubsub/topic/index.ts | Pub/Sub v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/pubsub/schedule/index.ts | スケジュール(Pub/Sub)v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/https/onRequest/index.ts | HTTPS onRequest の型 import を公開サブパスへ移行 |
| functions/src/v1/https/onCall/index.ts | HTTPS onCall の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/public/user/year/vote/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/public/user/year/team/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/public/user/year/submission/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/public/user/year/judge/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/public/user/year/finalVote/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/public/user/year/finalJudge/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/public/user/index.ts | (コメントアウト行の)Firestore v1 型 import の更新 |
| functions/src/v1/firestore/private/user/year/vote/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/private/user/year/team/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/private/user/year/submission/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/private/user/year/judge/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/private/user/year/finalVote/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/private/user/year/finalJudge/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/private/user/year/entry/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/private/user/tx/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/private/user/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/config/symbol/node/check/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/admin/user/year/vote/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/admin/user/year/team/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/admin/user/year/submission/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/admin/user/year/judge/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/admin/user/year/finalVote/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/admin/user/year/finalJudge/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/admin/user/year/entry/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/admin/user/tx/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/firestore/admin/user/index.ts | Firestore v1 の型 import を公開サブパスへ移行 |
| functions/src/v1/auth/index.ts | Auth v1 の型 import を公開サブパスへ移行 |
| functions/src/utils/firebase/logger.ts | firebase-functions import を v1 サブパスへ移行 |
| functions/src/utils/firebase/hasAlreadyTriggered.ts | EventContext の import を v1 サブパスへ移行 |
| functions/src/utils/firebase/baseFunction.ts | firebase-functions import を v1 サブパスへ移行 |
| functions/package.json | Node engines / 依存更新 / overrides 追加 |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| "engines": { | ||
| "node": "18" | ||
| "node": "22" | ||
| }, |
| "@types/node": "22.19.20", | ||
| "@types/ws": "^8.18.1", |
概要
メンテナンス再生作業の PR2/4。Cloud Functions の依存を刷新し、デプロイ先ランタイムを Node 22 へ。Gen1(v1)トリガー構成は維持(Gen2/Node 24 は
auth.user()等の再設計が必要でスコープ外)。主な変更
engines.node18 → 22(Gen1 上限。Node 24 は Gen2 専用)firebase-admin^10 → ^13.10 /firebase-functions^4 → ^6.6(v1 名前空間維持。モジュールロード・tsc 型チェック確認済み)firebase-functions/v1,/v1/firestore,/v1/storage,/v1/auth)@types/nodeを 22.x に固定(Node 18 types は TS 5.9 のジェネリック TypedArray と非互換)axios/ws/rxjs/@slack/web-api/ TypeScript 5.9 / ESLint 8.57 / @typescript-eslint 8 / Prettier 3 / firebase-functions-test 3 を更新overrides:crypto-js4.2.0(merkletreejs が引く脆弱な 3.3.0 対策)/axios^1.17.0(OpenAPI クライアント内蔵の旧 axios)/bn.js5.2.3。決定的ハッシュ出力は不変、testnet デプロイで結合検証脆弱性
--audit-level=high検証
npm ci成功 /tscビルド 0 エラー / 生成lib/index.jsのモジュールロード成功(v1 API 実行時互換確認)🤖 Generated with Claude Code