-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bug: Images not loading on web due to CORS policy #236
Comments
Hey @mdmohsin7 I have worked upon this issue making required changes and testing them this is the outcome of my research and testing hosting the images to this url and then using in the app solves this issue. bug_fixed_monumento.mp4 |
Please assign me this issue so I can open a PR regarding the fix. |
Same goes for these images as well at lib/scripts/populate_monuments.js
Monumento.-.Google.Chrome.2025-01-23.20-06-58.mp4 |
hey @xkaper001 what command are you using to run the app ? are you using you can change the web render by if you want to provide a solution on this matter it would be highly appreciated if you provide a more robust and fool-proof solution than changing the image hosting url a better approach would be you can change the default behaviour of using canvaskit to html by using a shell script like .sh file for linux and macos and .bat file for windows |
if you need help with flutter commands you can always use |
Timeline.1.mp4this is the result when using |
hey @HelloSniperMonkey, I recently tried using the HTML renderer But realized that we were developing with "deprecated HTML renderer" rather than CanvasKit. I proposed a "simple fix" that could resolve this issue when using Canvaskit but ig that was lame of me. Also, regarding your approach/solution to this issue, my thoughts don't fully align with it, Working on fixing "x" on a deprecated HTML renderer doesn't seem ideal. Instead, I suggest another approach - uploading the image to Firebase storage and then linking it to Your thoughts on this? |
The thing is firebase storage requires a paid plan and if you have been following the discord channel there is a discussion to migrate from firebase to pocketbase or appwrite so it would be helpful to prepare accordingly |
Yes, I was part of that conversation, and that's mentioned too. However, this approach doesn't have to rely solely on Firebase. When migrating, We could tweak it to work with PocketBase or Appwrite by utilizing their respective admin SDKs. |
🐛 Describe the bug
Description:
There are images in the Flutter app that aren't loading (details below) on the web due to CORS policy restriction. These images are hosted by a user who created the project, as these are from the user's firebase storage, and although it's an open-source project, the images are not accessible.
Steps to Reproduce
Video Preview of the bug
bug_monumento.mp4
Cause of issue.
1. In lib/utils/constants.dart,
this line points to the default user profile image, which when opened on mobile or directly via link opens fine but is blocked on the web due to CORS policy of the firebase hosted account. which issue the contributors when running on their machine.
2. In lib/scripts/populate_monuments.js
Similar to cause 1, this is a part of script
populate_monuments.js
updates these links to the testing user's firebase, which causes the same error.Proposed Solution
1. Host images on a public server for these test images. (Recommended)
This includes hosting images on sites like imgBB which allows permanent hosting of images also allowing to embed them. It works for our use case. (tried and tested)
2. Enable CORS Policy on the Admin's Firebase Console. (Not Recommended)
As AOSSIE, an open-source community working on an open-source project, we should use avoid using ways which may increase dependance on any object such as this Image hosting.
The text was updated successfully, but these errors were encountered: