小编Cam*_*opy的帖子

错误:超出截止日期 - 调用 firebase 可调用云函数 (onCall) 时。onRequest 工作正常

调用 firebase 可调用云函数 (onCall) 时,我在前端收到“超过截止日期”错误。

\n\n

我知道我必须返回一个 Promise,以便该函数知道何时清理自身,但它仍然不起作用。

\n\n

60 秒后,“deadline-exceeded”被抛出到前端,但该函数继续在服务器上运行并成功完成。所有批处理操作都会写入 firestore。

\n\n
10: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\n
Run Code Online (Sandbox Code Playgroud)\n\n
async 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)

javascript firebase google-cloud-functions

4
推荐指数
1
解决办法
1714
查看次数