javascript - 捕获错误时;在 Firebase 中获取 error.message 作为 INTERNAL
问题描述
requestForm.addEventListener("submit", (e) => {
e.preventDefault();
const addRequest = firebase.functions().httpsCallable("addRequest");
addRequest({
text: requestForm.request.value,
})
.then(() => {
requestForm.reset();
requestForm.querySelector(".error").textContent = "";
requestModal.classList.remove("open");
})
//Error is caused beacuse of this
.catch((error) => {
requestForm.querySelector(".error").textContent = error.message;
});
});
函数日志错误
Unhandled error RangeError: Maximum call stack size exceeded
at getIteratee (/srv/node_modules/lodash/lodash.js:5945:25)
at Function.map (/srv/node_modules/lodash/lodash.js:9580:31)
at encode (/srv/node_modules/firebase-functions/lib/providers/https.js:177:18)
at /srv/node_modules/lodash/lodash.js:13427:38
at /srv/node_modules/lodash/lodash.js:4925:15
at baseForOwn (/srv/node_modules/lodash/lodash.js:2990:24)
at Function.mapValues (/srv/node_modules/lodash/lodash.js:13426:7)
at encode (/srv/node_modules/firebase-functions/lib/providers/https.js:183:18)
at arrayMap (/srv/node_modules/lodash/lodash.js:639:23)
at Function.map (/srv/node_modules/lodash/lodash.js:9580:14)
addRequest
Function execution took 309 ms, finished with status code: 500
该函数应该检查 firebase 中的正常 HTTPS 错误,例如“未经身份验证”和“无效参数”,但得到了INTERNAL ERROR
虽然做firebase服务它仍然捕获错误但是使用firebase部署它甚至没有进入catch函数它显示error.message为“INTERNAL”?这意味着什么
解决方案
推荐阅读
- javafx - 如何使密码字段的内容可见?
- javascript - 量角器:如何在运行时动态地将元素分配给变量
- mongodb - 通过驱动程序检查 mongo 中的当前 CPU 负载?
- mysql - 如何在SQL中找到两列的最大乘积
- java - 使用 Junit 在 Spring Boot 中编写单元测试的更好方法是什么?
- tensorflow - 如何在张量流中填充序列
- ibm-integration-bus - ESQL 转换日期格式
- python - 使用python创建kubernetes pod时如何传递安全上下文?
- node.js - 使用 Node.js 的 Redshift 查询中的 DatetimeParseError
- r - 防止 textOutput 产生换行符