调用 firebase 可调用云函数 (onCall) 时,我在前端收到“超过截止日期”错误。
\n\n我知道我必须返回一个 Promise,以便该函数知道何时清理自身,但它仍然不起作用。
\n\n60 秒后,“deadline-exceeded”被抛出到前端,但该函数继续在服务器上运行并成功完成。所有批处理操作都会写入 firestore。
\n\n10:37:14.782 AM\nsyncExchangeOperations\nFunction execution took 319445 ms, finished with status code: 200\n10:36:57.323 AM\nsyncExchangeOperations\nFunction execution started\n10:36:57.124 AM\nsyncExchangeOperations\nFunction execution took 170 ms, finished with status code: 204\n10:36:56.955 AM\nsyncExchangeOperations\nFunction execution started\nRun Code Online (Sandbox Code Playgroud)\n\nasync function syncBinanceOperations(\n userId,\n userExchange,\n userExchangeLastOperations,\n systemExchange\n) {\n try {\n const client = Binance({\n apiKey: userExchange.apiKey,\n apiSecret: userExchange.privateKey\n });\n\n const batch = admin.firestore().batch();\n const lastOperations = userExchangeLastOperations\n ? userExchangeLastOperations\n : false;\n\n const promises = [];\n\n promises.push(\n syncBinanceTrades(client, lastOperations, userId, …Run Code Online (Sandbox Code Playgroud)