Skip to content

fix: update Firebase project from based-hardware-dev to based-hardware in prebuilt configs - #5945

Closed
sungdark wants to merge 2 commits into
BasedHardware:mainfrom
sungdark:main
Closed

sungdark wants to merge 2 commits into
BasedHardware:mainfrom
sungdark:main

Conversation

@sungdark

Copy link
Copy Markdown

Summary

Fix Firebase project mismatch causing 401 errors in setup.sh.

Problem: The prebuilt Firebase configs in were referencing based-hardware-dev, but the dev backend (api.omiapi.com) now validates tokens against the based-hardware (prod) Firebase project. This project mismatch caused all API calls to return 401.

Root Cause (confirmed in issue #5939):

  • Dev backend Helm values: GOOGLE_CLOUD_PROJECT: based-hardware
  • Prebuilt configs were pointing to based-hardware-dev

Changes (3 files updated):

  • app/setup/prebuilt/firebase_options.dart: projectId updated from based-hardware-dev to based-hardware (3 occurrences)
  • app/setup/prebuilt/google-services.json: project_id updated from based-hardware-dev to based-hardware
  • app/setup/prebuilt/GoogleService-Info.plist: PROJECT_ID updated from based-hardware-dev to based-hardware

Files changed: app/setup/prebuilt/firebase_options.dart app/setup/prebuilt/google-services.json app/setup/prebuilt/GoogleService-Info.plist

@greptile-apps

greptile-apps Bot commented Mar 23, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR fixes a Firebase project mismatch that was causing 401 errors during setup.sh by updating the prebuilt configs to point projectId/project_id/PROJECT_ID from based-hardware-dev to based-hardware, aligning with the backend's GOOGLE_CLOUD_PROJECT Helm value. The fix correctly resolves the authentication token validation failure, but the change is incomplete: the companion storage and auth-domain fields still reference the old based-hardware-dev project in all three config files.

Key changes:

  • app/setup/prebuilt/firebase_options.dart — projectId updated from based-hardware-dev → based-hardware for all four platform configs (android, ios, web, macos)
  • app/setup/prebuilt/google-services.json — project_id updated in project_info
  • app/setup/prebuilt/GoogleService-Info.plist — PROJECT_ID updated

Issues found:

  • storageBucket / storage_bucket / STORAGE_BUCKET still points to based-hardware-dev.firebasestorage.app in all three files — Firebase Storage operations will fail because a based-hardware identity token is not authorised to access a bucket owned by based-hardware-dev
  • authDomain in the web config (firebase_options.dart line 67) still reads based-hardware-dev.firebaseapp.com — web OAuth redirect flows will target the wrong Firebase project's hosting domain

Confidence Score: 3/5

  • The PR partially fixes the mismatch but leaves storage buckets and web auth domain pointing at the old project, which will break Firebase Storage and web OAuth flows.
  • The core authentication fix (projectId alignment) is correct and will resolve the reported 401 errors. However, all three files still have storageBucket/authDomain values referencing based-hardware-dev, creating a new cross-project resource mismatch that will surface as 403 errors on any Firebase Storage call and broken web sign-in redirects. These are real runtime failures on the primary user path, so the PR needs those fields updated before it is safe to merge.
  • All three changed files require follow-up: storageBucket in firebase_options.dart (lines 48, 56, 68, 76), storage_bucket in google-services.json (line 5), STORAGE_BUCKET in GoogleService-Info.plist (line 22), and authDomain in firebase_options.dart (line 67).

Important Files Changed

Filename Overview
app/setup/prebuilt/firebase_options.dart projectId updated to 'based-hardware' across all four platform configs, but storageBucket (all platforms) and authDomain (web) still reference 'based-hardware-dev', which will cause storage and web OAuth failures.
app/setup/prebuilt/google-services.json project_id correctly updated to 'based-hardware', but storage_bucket still points to 'based-hardware-dev.firebasestorage.app', creating a cross-project storage access issue for Android.
app/setup/prebuilt/GoogleService-Info.plist PROJECT_ID correctly updated to 'based-hardware', but STORAGE_BUCKET still references 'based-hardware-dev.firebasestorage.app', which will cause iOS Firebase Storage operations to fail.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[App initialises Firebase] --> B[Auth token issued for production project]
    B --> C[API call to backend]
    C --> D[Token validated successfully]
    D --> E[HTTP 200 returned]
    B --> F[Storage operation using mismatched bucket]
    F --> G[HTTP 403 returned]
Loading

Reviews (1): Last reviewed commit: "fix: update Firebase project from based-..." | Re-trigger Greptile

messagingSenderId: '1031333818730',
projectId: 'based-hardware-dev',
projectId: 'based-hardware',
storageBucket: 'based-hardware-dev.firebasestorage.app',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Stale storageBucket still references based-hardware-dev

The projectId has been correctly updated to based-hardware across all four platform configs (android, ios, web, macos), but the storageBucket on every entry still points to based-hardware-dev.firebasestorage.app. Firebase Storage access is scoped to the project that owns the bucket. If the app issues any storage reads/writes using these configs, the token minted against the based-hardware project will not be authorized to access a bucket that belongs to based-hardware-dev, resulting in a 403 Forbidden from Firebase Storage.

If the intent is to migrate fully to the based-hardware project the storageBucket values should be updated as well:

Suggested change
storageBucket: 'based-hardware-dev.firebasestorage.app',
storageBucket: 'based-hardware.firebasestorage.app',

The same applies to the ios (line 56), web (line 68), and macos (line 76) configs — all four storageBucket fields need the same update.

Also note that the web config still has authDomain: 'based-hardware-dev.firebaseapp.com' (line 67), which should become based-hardware.firebaseapp.com so that web OAuth redirect flows use the correct Firebase Hosting domain for the production project.

"project_number": "1031333818730",
"project_id": "based-hardware-dev",
"project_id": "based-hardware",
"storage_bucket": "based-hardware-dev.firebasestorage.app"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 storage_bucket still points to the old based-hardware-dev project

The top-level storage_bucket in project_info still reads based-hardware-dev.firebasestorage.app even though project_id has been updated to based-hardware. The Android SDK reads this value when initialising FirebaseStorage. Calls to Cloud Storage from Android will therefore present a based-hardware identity token to a bucket owned by based-hardware-dev, which will be rejected.

Suggested change
"storage_bucket": "based-hardware-dev.firebasestorage.app"
"storage_bucket": "based-hardware.firebasestorage.app"

<string>based-hardware-dev</string>
<string>based-hardware</string>
<key>STORAGE_BUCKET</key>
<string>based-hardware-dev.firebasestorage.app</string>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 STORAGE_BUCKET still references the old based-hardware-dev project

PROJECT_ID is now correctly based-hardware, but the STORAGE_BUCKET key still holds based-hardware-dev.firebasestorage.app. The iOS Firebase SDK uses this key to determine which bucket to target for storage operations. Any Firebase Storage call on iOS will fail with a permission error because the based-hardware identity token does not grant access to the based-hardware-dev bucket.

Suggested change
<string>based-hardware-dev.firebasestorage.app</string>
<string>based-hardware.firebasestorage.app</string>

Before confirming cancellation, users are now asked to select a reason
from predefined options (too expensive, not using enough, missing features,
found alternative, temporary break, other). Optional details can also be
provided. The reason and details are passed to the backend and logged.

- Add UnsubscribeReasonDialog component with 6 reason options and
  optional details textarea
- Update PlansSheet to show reason dialog before cancel confirmation
- Update cancelSubscription API to accept reason and details parameters
- Update backend endpoint to accept and log cancellation reason
Fixes BasedHardware#5904
@beastoin

Copy link
Copy Markdown
Collaborator

AI PRs with low efforts are not welcome here. Thank you. — by CTO

@beastoin beastoin closed this Mar 28, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Hey @sungdark 👋

Thank you so much for taking the time to contribute to Omi! We truly appreciate you putting in the effort to submit this pull request.

After careful review, we've decided not to merge this particular PR. Please don't take this personally — we genuinely try to merge as many contributions as possible, but sometimes we have to make tough calls based on:

  • Project standards — Ensuring consistency across the codebase
  • User needs — Making sure changes align with what our users need
  • Code best practices — Maintaining code quality and maintainability
  • Project direction — Keeping aligned with our roadmap and vision

Your contribution is still valuable to us, and we'd love to see you contribute again in the future! If you'd like feedback on how to improve this PR or want to discuss alternative approaches, please don't hesitate to reach out.

Thank you for being part of the Omi community! 💜

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.

2 participants