Actions not working after converting app to multi tenant (save, delete, uploads)

Hi everyone, I really need some help understanding what’s going wrong in my project.

I first built a project app in Google AI Studio, and later rebuilt it into a multi tenant setup where multiple companies can register and only access their own isolated data. After I made this change, several core functions stopped working and I can’t figure out why.

Here’s what’s happening:

• Image uploads no longer save correctly. Sometimes nothing happens, sometimes the image appears and then disappears.
• Delete functions don’t work. Buttons that should remove data simply do nothing.
• Several buttons in general have stopped responding. Pressing “Save” or “Delete” doesn’t trigger any visible action, even though these functions worked perfectly before adding the multi tenant structure.

I haven’t changed any UI logic, only the database structure, so I’m confused about why these actions have stopped working.

I’d be grateful for any guidance. In particular, I’d love help with:

• What I should double check in my multi tenant setup to ensure actions like saving, deleting and uploading images are being routed to the correct tenant’s data
• Whether issues with organization IDs, collection paths or Firestore security rules could silently block actions like this
• Whether it would help if I shared my database structure, security rules or specific code snippets for the actions
• Any recommended way to debug UI actions in Google AI Studio when no error message appears

I’m stuck and would really appreciate any insight or troubleshooting steps. Thank you so much in advance.

This behavior is a classic symptom of “Firestore Security Rules” blocking your new data structure. When you move from a simple user-based app to a multi-tenant (organization-based) app, your database paths change, but the security rules often remain stuck in the old logic.

Check for Silent Errors

1. First, verify that this is indeed a permissions issue.

  • Open your app in Chrome.
  • Right-click anywhere and select Inspect > Console .
  • Try to upload an image or click “Delete”.
  • Look for red text in the console saying:

FirebaseError: Missing or insufficient permissions.

2. Update Firestore Security Rules

In a standard AI Studio/Firebase prototype, rules usually default to allowing a user to edit only their own document (users/{userId}).

In a multi-tenant setup, you likely moved data to a structure like organizations/{orgId}/… You need to update your rules to check if the user belongs to that organization.

Go to Firebase Console > Firestore Database > Rules and compare with this pattern

3. Fix Image Uploads (Storage Rules)

Image uploads use Firebase Storage , which has a completely separate set of rules. The “appear then disappear” behavior happens when the upload starts at UI but the backend rejects the final write.

4. Include Error logging

If you exported your code (e.g., to React/Next.js) or are editing within a “Build” environment, the UI might miss errors. You should wrap your actions in try/catch blocks to see what’s happening.

Hope these tips helps you resolve bugs hindering development.

1 Like