FlutterFlow / flutterflow-issues

A community issue tracker for FlutterFlow.
130 stars 26 forks source link

CORS error of place picker in Web app when hosted on firebase #4786

Closed FilliTech closed 1 day ago

FilliTech commented 3 weeks ago

Can we access your project?

Current Behavior

When I attempt to select a location using the flutterflow place picker, a CORS error occurs.

Expected Behavior

It should work properly as it does if hosted on flutterflow.

Steps to Reproduce

  1. Create a web page with place picker widget.
  2. Connect the project with firebase
  3. Download the code locally
  4. Host the website in firebase hosting
  5. Try to select the location using place picker

Reproducible from Blank

Bug Report Code (Required)

IT4eiPLqw4t1pbxH7qXxbcFFiSQvHEw7aIIZke5+ZAwbG4z1PbNzY+j+TGZuOLDid2xiPFmWgm00/vDJk/PxD8c4FByJbbZjzJdcbgH/Qj2VeJClBs+sYUFCQOdhJmKOzpuZnBUkJulZR1Ej1GGEJeqiaHLYNr6xC1c/APilMrDPn2CfLgDKGn0Jg1ZSfCvr

Visual documentation

Screenshot 2024-10-30 at 18 23 07

Environment

- FlutterFlow version: 5.0.8
- Platform: web
- Browser name and version: any
- Operating system and version affected: any

Additional Information

No response

Alezanello commented 3 weeks ago

Hello!

I wasn’t able to replicate the issue on my end. It looks like you're hosting the project on Firebase rather than FlutterFlow. In that case, you'll need to add a proxy to the Place Picker API call within your code before deploying it to Firebase hosting.

When hosted on FlutterFlow, this feature works as expected. Here’s a link to a recently published project via FlutterFlow where you can test it:
https://qa-2935-99mbtu.flutterflow.app/

FilliTech commented 3 weeks ago

The project is hosted on Firebase, on FlutterFlow it works as expected. The problem is that I am using the flutterflow place picker component so I can not, as of my knowledge, add a proxy to the api call.

github-actions[bot] commented 2 weeks ago

This issue is stale because it has been open for 7 days with no activity. If there are no further updates, a team member will close the issue.

Alezanello commented 6 days ago

Hello, and I apologize for the delayed response. In your Firebase project code, you can navigate to /lib/flutterflow/flutter_flow_place_picker.dart. Within this file, add the proxy to the baseUrl before widget.proxyBaseUrl.

image.png
Alezanello commented 1 day ago

Closing this issue since we haven't heard back from you. If you are still facing the problem please submit a new issue. Have a great day!