CannabisData / cannabisdata

Cannabis Data monorepo
MIT License
8 stars 1 forks source link

Get Started - Profile - unable to upload image #2

Open gregoryfoster opened 1 year ago

gregoryfoster commented 1 year ago
  1. On initial sign in, prompted to "Create your profile"
  2. On selecting an image to upload, error in browser console

Error: Uncaught (in promise) FirebaseError: Firebase Storage: User does not have permission to access 'users/y3iPLGpfixTxRAEcVvfXXsRMJeT2/user_photos/cannabis_observer-icon-square.png'. (storage/unauthorized)

gregoryfoster commented 1 year ago

Same issue when navigating via profile icon in upper right, "Your account", and attempting to upload photo.

keeganskeate commented 1 year ago

The main thing missing I believe was that I had yet to publish the Firestore and Firebase Storage security rules. After publishing the rules and a minor refactor of the code, the user photo management functionality appears to work.

firebase deploy --only firestore:rules
firebase deploy --only storage:rules
gregoryfoster commented 1 year ago

Slightly farther, here's the new error message:

Uncaught (in promise) TypeError: Cannot read properties of null (reading 'uid')
    at updateUserPhoto (firebase.js:174:46)
    at HTMLInputElement.uploadUserPhoto (user.js:30:247)