typescript - 错误代码 16 和错误代码 14,带有调度云功能
问题描述
我的预定云功能出现这两个错误,这些功能运行良好,但在我的日志中我得到了这些:
Error: 14 UNAVAILABLE: No connection established
at Object.callErrorFromStatus (/workspace/node_modules/@grpc/grpc-js/build/src/call.js:30:26)
at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client.js:175:52)
at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:341:141)
at Object.onReceiveStatus (/workspace/node_modules/@grpc/grpc-js/build/src/client-interceptors.js:304:181)
at Http2CallStream.outputStatus (/workspace/node_modules/@grpc/grpc-js/build/src/call-stream.js:116:74)
at Http2CallStream.maybeOutputStatus (/workspace/node_modules/@grpc/grpc-js/build/src/call-stream.js:155:22)
at Http2CallStream.endCall (/workspace/node_modules/@grpc/grpc-js/build/src/call-stream.js:141:18)
at Http2CallStream.cancelWithStatus (/workspace/node_modules/@grpc/grpc-js/build/src/call-stream.js:457:14)
at ChannelImplementation.tryPick (/workspace/node_modules/@grpc/grpc-js/build/src/channel.js:237:32)
at Object.updateState (/workspace/node_modules/@grpc/grpc-js/build/src/channel.js:106:26)
和这个:
Error: Process exited with code 16
at process.on.code (/layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/invoker.js:396:29)
at process.emit (events.js:198:13)
at process.EventEmitter.emit (domain.js:448:20)
at process.exit (internal/process/per_thread.js:168:15)
at logAndSendError (/layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/invoker.js:184:9)
at process.on.err (/layers/google.nodejs.functions-framework/functions-framework/node_modules/@google-cloud/functions-framework/build/src/invoker.js:393:13)
at process.emit (events.js:198:13)
at process.EventEmitter.emit (domain.js:448:20)
at emitPromiseRejectionWarnings (internal/process/promises.js:140:18)
at process._tickCallback (internal/process/next_tick.js:69:34)
这是我的代码:我每 5 分钟运行一次用于测试目的的函数,它将在每个月的每一天运行一次。
import * as functions from "firebase-functions";
import * as admin from "firebase-admin";
/// Checks every day if the debt pay day is equal to the setting and add the corresponding amount to
/// the debt
export const checkForMonthChange = functions.pubsub
.schedule("every 5 minutes")
.onRun(async (context) => {
const configData = await admin
.firestore()
.doc("neighbors/0000_admin")
.get();
const dayToPay = configData.data()?.day_of_month_to_pay;
console.log(`Day to Pay: ${dayToPay}`);
const dayOfMonth = admin.firestore.Timestamp.now()
.toDate()
.toString()
.substr(8, 2);
console.log(`Current Day of Month: ${dayOfMonth}`);
if (dayOfMonth === dayToPay) {
return admin
.firestore()
.collection("neighbors")
.get()
.then((snapshot) => {
snapshot.forEach((doc) => {
return doc.ref.update({
debt: doc.data()?.debt + configData?.data()?.monthly_pay,
});
});
});
} else {
return null;
}
});
解决方案
推荐阅读
- ansible - Ansible:在 postgres 中将角色附加到用户
- java - 我的 jScrollPane 在我的 AbstractTableModel 上不起作用
- python - 在没有 GoogleService-Info.plist 的情况下将调试符号上传到 Crashlytics
- eclipse-che - 无法在 kubernetes 上运行 eclipse che
- amazon-web-services - 如何为多个账户使用 AWS CLI
- typescript - 打字稿条件属性未能用于函数参数
- dask-distributed - 您可以使用从数据已分区的现有 MPI 作业分发的 Dask 吗?
- c++ - std::optional:简单和引用限定值()之间的有效区别
- amazon-web-services - AWS Chalice - 发送文件作为响应
- asp.net-core - Azure Devops 中应用程序和配置设置的语法