Complete the checklist below to audit a room in this branch.
Loading branch information...
Room Inspection Checklist
Additional Notes
CORS Issues with Photo Uploads
What is happening?
When you try to upload photos from a development environment (like http://localhost or http://127.0.0.1), browsers enforce a security policy called CORS (Cross-Origin Resource Sharing) that prevents your local website from uploading files to Firebase Storage.
How does this affect me?
You can still use all features of the application except for photo uploads. Your audits will be saved without photos.
Solutions for developers:
Configure CORS in Firebase Storage:
# Install gsutil (part of Google Cloud SDK)
gsutil cors set cors-config.json gs://your-firebase-bucket
# Example cors-config.json:
[
{
"origin": ["http://localhost:5000", "http://127.0.0.1:5500"],
"method": ["GET", "POST", "PUT", "DELETE"],
"maxAgeSeconds": 3600
}
]
Deploy to Firebase Hosting:
When the app is deployed to Firebase Hosting, CORS issues disappear because the app and storage are on the same domain.
Use Firebase Emulators:
For local development, Firebase provides emulators that avoid CORS issues.
What to do now:
Continue using the application without photo uploads. All other functions work normally, and your audit data will be saved correctly.
Simple Workaround: Instead of uploading photos, you can describe the issues in detail in the "Audit Notes" section. For example:
"Door lock is loose at hinges, approx. 2mm gap visible. See photos sent separately via email to maintenance@example.com"