Firebase JavaScript V9 RTDB update报错:values参数含未定义属性及静默失败问题
Firebase update调用静默失败的解决方案
有些时候,你写的update调用会莫名其妙静默失败,比如这段代码:
await update(ref, {...properties})
明明它返回的是Promise,但不管用then/catch链式调用还是直接用await都抓不到错误。
解决办法很简单,把整个调用逻辑包进try/catch块里:
try{ await update(ref, {...properties}) } catch (error) { console.log(error) }
这时候控制台就能正常输出错误信息了:
Error: update failed: values argument contains undefined in property...
之前踩过这个坑,折腾了好久才搞定,特意分享出来帮大家避坑。
内容的提问来源于stack exchange,提问作者Cerce
相关产品推荐
相关产品推荐

