【发布时间】:2021-07-22 23:46:57
【问题描述】:
全部,
一段时间以来,我一直在努力寻找原因,即我与谷歌云翻译的连接存在间歇性网络问题。首先,我使用了 googleTranslate v2,并且在检测界面上遇到超时错误。然后我切换到 v3,它也似乎出现了网络超时错误。
我在 Windows 笔记本电脑上开发,代码运行良好,没有超时。 (在我的家庭网络中)。
const testTranslate = await googleTranslate(messageText, cEnglish).catch(err => { console.error(err); return (languages); });
当我将代码移动到 Vultr VM 并运行相同的代码时,它会间歇性地超时:
at Object.callErrorFromStatus (/root/bots/node_modules/@grpc/grpc-js/build/src/call.js:31:26)
at Object.onReceiveStatus (/root/node-Modules/@grpc/grpc-js/build/src/client.js:176:52)
at Object.onReceiveStatus (/root/node-Modules/@grpc/grpc-js/build/src/client-interceptors.js:334:141)
at Object.onReceiveStatus (/root/node-Modules/@grpc/grpc-js/build/src/client-interceptors.js:297:181)
at /root/bots/node_modules/@grpc/grpc-js/build/src/call-stream.js:130:78
at processTicksAndRejections (internal/process/task_queues.js:79:11) {
code: 14,
details: 'No connection established',
metadata: Metadata { internalRepr: Map {}, options: {} }
}
正在寻找关于为什么我的 VM(是的,也存在不同的操作系统和 lib 版本)可能会失败的调试想法...
TIA!
【问题讨论】:
-
我不知道答案,但我的下一个调试步骤是从两个位置对 API 端点运行
mtr并查看结果。例如:mtr translate.googleapis.com
标签: javascript node.js networking google-cloud-platform google-translate