gpt4 book ai didi

javascript - PERMISSION_DENIED(为错误的数据库产品设置的规则)

转载 作者:行者123 更新时间:2023-12-01 15:04:37 26 4
gpt4 key购买 nike

数据库规则:

service cloud.firestore {
match /databases/{database}/documents {
match /{document=**} {
allow read, write;
}
}
}

存储规则:
service firebase.storage {
match /b/{bucket}/o {
match /{allPaths=**} {
allow read, write;
}
}
}

它说 Anyone with your database reference will be able to read or write to your database
我得到的错误:
Uncaught (in promise) Error: PERMISSION_DENIED: Permission denied
at firebase.js:1
at exceptionGuard (firebase.js:1)
at e.callOnCompleteCallback (firebase.js:1)
at firebase.js:1
at firebase.js:1
at t.onDataMessage_ (firebase.js:1)
at e.onDataMessage_ (firebase.js:1)
at e.onPrimaryMessageReceived_ (firebase.js:1)
at e.onMessage (firebase.js:1)
at e.appendFrame_ (firebase.js:1)
(anonymous) @ firebase.js:1
exceptionGuard @ firebase.js:1
e.callOnCompleteCallback @ firebase.js:1
(anonymous) @ firebase.js:1
(anonymous) @ firebase.js:1
t.onDataMessage_ @ firebase.js:1
e.onDataMessage_ @ firebase.js:1
e.onPrimaryMessageReceived_ @ firebase.js:1
(anonymous) @ firebase.js:1
e.appendFrame_ @ firebase.js:1
e.handleIncomingFrame @ firebase.js:1
mySock.onmessage @ firebase.js:1

我正在使用的代码示例:
let name = 'lorem'
let email = 'ipsum@test.com'
let imageUrl = 'secret_img_link'
let userId = 1231241241
firebase.database().ref('users/' + userId).set({
username: name,
email: email,
profile_picture : imageUrl
})

如果还需要什么,请询问。
我被困在那个错误上,对此无能为力。
重新创建应用程序,什么都不做。

最佳答案

好的,我自己找到了该怎么做。

转到数据库,标题旁边有两个选项:
Cloud Firestore ,Realtime database
选择实时数据库并转到规则

将规则更改为真。

这解决了我的问题。

关于javascript - PERMISSION_DENIED(为错误的数据库产品设置的规则),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51707898/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com