如何添加角色以允许实时数据库更新

How to add a role to allow updates in realtime database

我正在尝试更新实时数据库中的现有值,但出现权限被拒绝的错误

这是我的代码:

async function handleEventCancelation() {
        const eventRef = database.ref(`evento/${eventID}`);

        await eventRef.child(eventID || '').update({
            canceled: 'Y'
        })
    }
    

这里是角色槽:

"$eventoId": {
    ".read": true,
    ".write": "auth!=null && data.child('authorId').val() == auth.id"

有什么想法吗?

没关系,是'eventos'而不是'evento',像这样:

async function handleEventCancelation() {
    const eventRef = database.ref(`eventos/${eventID}`);

    await eventRef.child(eventID || '').update({
        canceled: 'Y'
    })
}