Skip to content

fix: Validate Firebase config before injection (DAT-11942)#2

Open
riffellabot wants to merge 1 commit intomainfrom
DAT-11942-firebase-config-validation
Open

fix: Validate Firebase config before injection (DAT-11942)#2
riffellabot wants to merge 1 commit intomainfrom
DAT-11942-firebase-config-validation

Conversation

@riffellabot
Copy link

Summary

Fixes DAT-11942: Incomplete Firebase config injection breaks Preview with auth/invalid-api-key error.

This implements the "Atomic Config or Nothing" principle - Firebase config is only injected if it contains all required keys (apiKey, projectId, appId).

Changes

  • Added isFirebaseConfigComplete() validation helper in frontend/vite.config.ts
  • Updated config injection logic to validate Firebase config before injection
  • Logs clear warnings when config is incomplete instead of injecting partial data
  • Prevents crashes in generated auth/config.ts module

Impact

  • Before: Template injected empty/incomplete Firebase config, causing Preview to crash
  • After: Template only injects complete config, skips injection if incomplete (with warning)

Test Plan

  • Verify Preview works when Firebase extension is enabled with complete config
  • Verify Preview doesn't crash when Firebase extension is enabled with incomplete config
  • Check console logs show appropriate warnings for incomplete configs
  • Confirm no regression for apps without Firebase extension

Related Issues

🤖 Generated with Claude Code

Implements "Atomic Config or Nothing" principle to fix issue where incomplete
Firebase config breaks Preview with auth/invalid-api-key error.

Changes:
- Added isFirebaseConfigComplete() to validate required keys (apiKey, projectId, appId)
- Only inject __FIREBASE_CONFIG__ if validation passes
- Log warning when config is incomplete instead of injecting partial config
- Prevents crash in generated auth/config.ts module

Fixes DAT-11942

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant