Database connection technical hurdles

Hello everyone, Let me start by saying I have very little programming knowledge, but with AI Studio, I have been working on an app that tracks livestock growth progress. I have worked to the point that I am ready to test the website/app with real customers, but I keep having connection issues with my database. I am currently using Firebase SDK v12.12.0.

Technical Summary: Firebase Project Configuration Conflict

  1. The “Database (default) Not Found” Error

The Symptom: Despite the Firebase Console showing a primary database named default, the application throws: Firestore (12.12.0): Database ‘(default)’ not found. Please check your project configuration.

The Conflict: The Firebase SDK expects the primary database to be called with no name or an empty string, but the development environment (AI Studio) keeps injecting the literal string “(default)” into the code and configuration files.

  1. Firestore Permission Denied (Landing Page vs. Core App)

The Symptom: Users trying to sign up on the landing page receive {“error”:“Missing or insufficient permissions.”}.

The Challenge: We are trying to merge “public-access” rules (for a waitlist collection on the landing page) with “private-group-access” rules (for a livestock management app) without breaking the complex isGroupMember and isValidLivestock helpers already in place.

  1. Multi-Instance Confusion

The Issue: The project appears to have multiple database instances created (e.g., (default) and ai-studio-generated-db).

The Risk: Data for a six-month-old red steer and weight management logs are being saved to one instance, while the landing page code is attempting to write to a different one.

  1. Configuration Persistence (The “Ghost” ID)

The Issue: Even after manually editing src/firebase.ts to use getFirestore(app), the development tool keeps reverting the configuration or referencing a databaseId in a JSON file that points back to the non-existent (default) string.

How do I force a Firebase project to strictly ignore the ‘databaseId’ parameter in all configuration files so it defaults to the primary instance without throwing a ‘Not Found’ error? Every time my AI tool generates code, it adds the string ‘(default)’, which crashes the Firestore connection.

Is there another platform that I can use to migrate my current work and complete the project, allowing me to proceed to testing? Does anyone have any suggestions for a novice like me to complete this project?

Thank you for your expertise and feedback.