FlutterFlow / flutterflow-issues

A community issue tracker for FlutterFlow.
123 stars 19 forks source link

Firebase backend not switching when changing environment #4026

Open dixonl90 opened 1 week ago

dixonl90 commented 1 week ago

Can we access your project?

Current Behavior

When I switch between the production and development environment, the firebase backend being used by the app does not change

Expected Behavior

When switching environments, the firebase backend used by the app should also update.

Steps to Reproduce

  1. Configure 2 Flutterflow environments
  2. Set a different Firebase backend for each environment
  3. Set the environment to the default production environment
  4. Run the app, create an account and log in
  5. Verify the account is created in the production backend
  6. Switch to the development environment
  7. Run the app and attempt to create an account and log in
  8. An error is returned: the account already exists. It exists on the production backend but not development.

Reproducible from Blank

Bug Report Code (Required)

IT48iPHqw5VNpbxa1s+JbvpV+SAXQz47R4Iz0epDTUw8J6rPPJkAZffBblRuTde+TVdqOVmJrGc00qCKkvPqG/oFCwSqeYNez7lUExXNTkKRacWlBs2SRXQlL9JgGX6a3KaCmA9QAMhaSCEewGWYIt+vVhLrK4f4ClQzL/yaKtjJpUq8FQzvFxBVzmNecCfn

Visual documentation

N/A

Environment

- FlutterFlow version: 5.0.5
- Platform: MacOS Desktop
- Browser name and version:
- Operating system and version affected: Mac 14.5

Additional Information

No response

Alezanello commented 1 week ago

Hello!

I’m sorry to hear you're experiencing this issue. Before we run some tests, could you let me know where you're trying the app after changing environments? Are you using Run Mode or Test Mode?

Thanks for your help!

dixonl90 commented 1 week ago

Hello!

I’m sorry to hear you're experiencing this issue. Before we run some tests, could you let me know where you're trying the app after changing environments? Are you using Run Mode or Test Mode?

Thanks for your help!

Hi @Alezanello, thanks for looking into this. I'm switching the environment and then using local run to test on my Android device.

After switching to the Development environment, I can see google-services.json is correctly updated if I open the code in VSCode. However, I added a breakpoint to FirebaseAuth.instance.createUserWithEmailAndPassword in lib/auth/firebase_auth/email_auth.dart and found the Production Firebase options had been passed.

dixonl90 commented 1 week ago

From VSCode, I ran flutter clean and then launch the app in release mode and it seems to have picked up the development Firebase backend. I assume it was the clean command that helped, but this means I expect a deployment will use the correct backend.