nrkno / transcriber-frontend

MIT License
32 stars 12 forks source link

Uncaught (in promise) FirebaseError: Missing or insufficient permissions. #88

Open dariushazimi opened 5 years ago

dariushazimi commented 5 years ago

Hello @baardl Code base: Lastest pull as of 10 AM EST July 11, 2019 Update: added db log showing the error.

I have deployed both the backend and frontend based on the instruction. I can upload an audio file but receive an error on the Web front end and Firebase logs.

Error Frontend:

image

Permission related? Could it be permission related? image

Below is the information about my setup and the location of the error.

My Env: Os: Linux ubuntu 19.4

transcriber-frontend git:(master) node -v      
v8.11.4
transcriber-frontend git:(master) npm -v       
5.8.0
   ╭─────────────────────────────────────╮
                                        
      Update available 5.8.0 → 6.9.0    
          Run npm i npm to update       
                                        
   ╰─────────────────────────────────────╯

Firebase Log Error

Transcription Failed: Error: Not Found at Util.parseHttpRespBody (/srv/node_modules/@google-cloud/storage/node_modules/@google-cloud/.../src/util.js:191:38) at Util.handleResp @google-cloud

image

image

Firebase functions

image

Database log

image

Snapshot of the storage with bucket showing files image

I have reviewed the storage as well as the code and can't figure out what or where the issue is. Could you please provide some info to resolve this? Am I missing a step in configuration? Don't know where to go from here...

Many thanks

dariushazimi commented 5 years ago

Looking at the dev tools in google chrome it maybe permission related. Uncaught (in promise) FirebaseError: Missing or insufficient permissions. But not sure what permission is missing?

Any idea?

image

baardl commented 5 years ago

Hi Darius. I guess you are logged in with your dev username/password? And that username/pw is setup in firebase?

I´m not really sure which part you are missing access to:

Our rules used for Storage:

service firebase.storage {
  match /b/{bucket}/o {
    match /media/{userId}/{media} {
      allow read: if request.auth.uid == userId;
      allow write: if request.auth.uid == userId && (request.resource.contentType.matches('audio/.*') || request.resource.contentType.matches('video/.*') || request.resource.contentType.matches('application/mxf'));
    }
  }
}

Our rules used for Cloud Firestore:

service cloud.firestore {
  match /databases/{database}/documents {

    function isSignedIn() {
      return request.auth != null;
    }

   match /transcripts/{transcriptId} {

      function transcriptUserId() {
            return get(/databases/$(database)/documents/transcripts/$(transcriptId)).data.userId;
      }

      match /paragraphs/{resultId} {
        allow create, list, update, delete: if isSignedIn() && transcriptUserId() == request.auth.uid;
      }

     match /results/{resultId} {
        allow create, list, update, delete: if isSignedIn() && transcriptUserId() == request.auth.uid;
      }

      allow get: if isSignedIn() && resource.data.userId == request.auth.uid;
      allow create: if isSignedIn() && request.resource.data.userId == request.auth.uid;
      allow list, update: if isSignedIn() && resource.data.userId == request.auth.uid;
    }
  }
}

Does this help you anything? Bård

dariushazimi commented 5 years ago

Hi Bard That’s right. I have created the user I’d and password in Firebase and use the dev env. It appears that both Firestore storage upload and Cloud Firestore works fine as I can upload and see the data on the Firestore storage and Cloud Firestore.

When it tries to call the functions to analyze and transcribe, it fails.

I like to test the prod deployment but not Clear about the steps. Do you have any instructions on how to deploy on Gcp, to try the full app in production mode?

Thanks.

baardl commented 5 years ago

Hi Darius.

No, unfortenately I do not have propper instructions, yet. Hope I will be able to produce something like that the next week.

Sorry for that. Bård

On Wed, Jun 12, 2019 at 2:23 PM Darius notifications@github.com wrote:

Hi Bard That’s right. I have created the user I’d and password in Firebase and use the dev env.

I like to test the prod deployment but not Clear about the steps. Do you have any instructions on how to deploy on Gcp, to try the full app in production mode?

Thanks.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/nrkno/transcriber-frontend/issues/88?email_source=notifications&email_token=AABI4ZCPVMCPSY47VIANJSLP2DTFHA5CNFSM4HW7J2VKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGODXQHLIA#issuecomment-501249440, or mute the thread https://github.com/notifications/unsubscribe-auth/AABI4ZFBJ2FI3D4RJDGNCP3P2DTFHANCNFSM4HW7J2VA .

dariushazimi commented 5 years ago

That would be great Bard. I can help with documentation, testing and debugging. To start with if you can provide the basic instructions for prod deployment, I can get started, share the results and provide feedback.

Thanks