opentrace-community / opentrace-cloud-functions

OpenTrace Cloud Functions. Reference implementation of the BlueTrace protocol.
https://bluetrace.io
GNU General Public License v3.0
273 stars 121 forks source link

Unhandled error { Error: 7 PERMISSION_DENIED: Missing or insufficient permissions. #47

Closed soriyasun closed 4 years ago

soriyasun commented 4 years ago

When I called getUploadToken which in turn calls await admin.firestore().collection('codes').doc('uploadCode').set({uploadCode: payloadData.toString('base64')}); I received the folowing error Unhandled error { Error: 7 PERMISSION_DENIED: Missing or insufficient permissions.

The database is in native mode

I tried several database rules, but did not succeed to overcome this issue. Below is one of the database rules

rules_version = '2'; service cloud.firestore { match /databases/{database}/documents { match /{document=**} { allow read, write: if request.auth != null;

Did someone come through this issue and solve the problem ?

alexissinglaire commented 4 years ago

@soriyasun : hi, did you configure the upload bucket name correctly in the gradle.properties ?

soriyasun commented 4 years ago

@soriyasun : hi, did you configure the upload bucket name correctly in the gradle.properties ?

@alexissinglaire thanks for your kick comment. I put the archive bucketname and double-checked it. Still the problem persist. I also tried the upload bucket name but not succeed yet.

getHandshakePin Function execution took 971 ms, finished with status code: 200 And the UID has been set.

Among the 2 buckets, upload and archive, I put the upload bucket in the gradle.properties

alexissinglaire commented 4 years ago

@soriyasun : i noticed your rule in the storage not the same as what being documented. this is the correct permissions: rules_version = '2'; service firebase.storage { match /b/{bucket}/o { match /{allPaths=**} { allow create: if request.auth != null; // Only allow write, Cloud Functions have read/write access by default. } } }

soriyasun commented 4 years ago

@alexissinglaire Thanks for your comment. In fact I rebuilt a complete new project for the cloud functions. Up to now so far so good. The mentionned error disappears. Upload Data works just fine. I'll come back with other issues for sure. I'm going to close this issue.