firebase-gcp-debug
Firebase + GCP Debug
Triage (always)
- Decide target: local emulators vs deployed (prod/staging)
- Identify
projectId(usually from.firebaserc/firebase.json) - Identify function/service name, region, and exact timestamp of the failure (UTC if possible)
- Collect the full error text + any request id / trace id
Local emulator workflow
- Confirm tooling versions:
node --versionfirebase --version
- Start only what you need (faster, less noise):
firebase emulators:start --only functions,firestore
- For Node debugging, enable inspector:
firebase emulators:start --only functions --inspect-functions
- Reproduce the issue and watch emulator logs.
- If the bug depends on Firestore rules/data, run with a known dataset:
- Use emulator import/export (
--import/--export-on-exit) when available in the repo.
- Use emulator import/export (
Deployed (prod) workflow
1) Verify auth + project selection
- Firebase CLI:
firebase login:listfirebase projects:listfirebase use <projectId>
- gcloud:
gcloud auth listgcloud config set project <projectId>
2) Find the right runtime (v1 vs v2)
- Prefer
firebase functions:listfirst. - If it’s Functions v2, logs are typically under Cloud Run (Cloud Logging
resource.type="cloud_run_revision").
3) Read logs (Cloud Logging)
Use tight filters: project, resource type, service/function name, and timestamp window.
- Functions v2 / Cloud Run service logs (most common for v2):
gcloud logging read 'resource.type="cloud_run_revision" AND resource.labels.service_name="<service>" AND timestamp>="<ISO8601>"' --limit 100
- Functions v1 logs:
gcloud logging read 'resource.type="cloud_function" AND resource.labels.function_name="<function>" AND timestamp>="<ISO8601>"' --limit 100
Tips:
- Add
severity>=ERRORto narrow failures. - If you have a trace id, add
trace="projects/<projectId>/traces/<traceId>".
Firestore/Auth/Storage quick checks
- Firestore permission issues:
- Confirm rules target (emulator vs deployed)
- Check
PERMISSION_DENIEDlogs and the affected document path
- Index errors:
- Errors usually include a console link to create the missing index
- Auth:
- Validate token audience/project mismatch (
aud,iss,project_id)
- Validate token audience/project mismatch (
Project pack references (optional)
- If the repo provides project-specific Firebase notes under
.skills-hub/firebase/references/, read them as needed. - Keep core troubleshooting generic; keep repo-specific shortcuts and business docs in project packs.
Execution notes
- Any command that reaches Firebase/GCP APIs may require network access, auth context, or sandbox approval depending on the host agent.
- If your agent gates CLI or network calls, enable that access before running
firebaseorgcloud.
Safety
- Never paste service account JSON keys into chat; use a file path and redact sensitive fields.
- Prefer least-privilege roles and short-lived credentials.
More from xiaojiongqian/skills-hub
patent-search-cn-us
Patent prior-art search and novelty check guidance focused on China and the United States (CNIPA, USPTO, Google Patents, WIPO). Use when asked to plan or run CN/US patent searches, draft search strategies, or produce a preliminary novelty search report.
85jina-web-fetch
Fetch webpage text with a normal HTTP request first, then automatically fall back to jina.ai proxy when direct access fails or returns login/JS-blocked content. Use when extracting content from X (Twitter) or other pages that are hard to read directly.
52git-pr-merge
>
12gh-fix-ci
Inspect GitHub PR checks with gh, pull failing GitHub Actions logs, summarize failure context, then create a fix plan and implement after user approval. Use when a user asks to debug or fix failing PR CI/CD checks on GitHub Actions and wants a plan + code changes; for external checks (e.g., Buildkite), only report the details URL and mark them out of scope.
9auto-dev
>
8playwright-mcp
Use Playwright MCP for browser automation and regression checks when Chrome DevTools MCP is unavailable, when you need cross-browser coverage (Chromium/Firefox/WebKit), or when scripted browser control is more reliable.
7