【发布时间】:2021-01-28 13:55:35
【问题描述】:
我根本找不到 NodeJS Admin SDK 在发送消息时可以返回给我的所有错误代码。例如这段代码:
this.app
.messaging()
.sendToDevice(an_invalid_registration_token, message, {
priority: 'high',
})
.then((response: MessagingDevicesResponse) => {
console.log(response.results[0].error)
})
它会输出给我这个:
{
errorInfo: {
code: 'messaging/invalid-registration-token',
message: 'Invalid registration token provided. Make sure it matches the registration token the client app receives from registering with FCM.'
},
codePrefix: 'messaging'
}
首先,此输出与documentation 描述的不同(我自愿在此处删除了堆栈)您可以看到属性codePrefix 未在文档中定义。但是我也不能像这里出现的messaging/invalid-registration-token 那样处理所有错误代码。我确实找到了all these error codes,但我在我的示例中找到的是此处列出的注释。那么在其他地方还有其他列表吗?
是我遗漏了什么还是我做错了什么?
【问题讨论】:
标签: node.js firebase firebase-cloud-messaging