Google 云 TCP 超时 (ETIMEDOUT)
Google Cloud TCP Timeouts (ETIMEDOUT)
我遇到了以下问题:
Error: connect ETIMEDOUT 209.85.234.27:25
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16) {
当 运行 GCP 上的以下代码(Cloud Functions 和 Cloud 运行 都失败)时:
const verifier = require('email-verify')
const express = require('express')
const app = express()
/**
* Verify an email address
*/
app.post('/verify', async (request, response, _next) => {
const email = request.query.email
console.log(`Verifying ${email}`)
const isValid = await new Promise(function (resolve, _reject) {
if (!email || typeof email !== 'string') {
return resolve(false)
}
verifier.verify(email, function (err, info) {
if (err) {
console.error(err)
return resolve(false)
}
return resolve(info.success)
})
})
response.json({ valid: isValid, email: typeof email === 'string' ? email : '' })
})
const port = process.env.PORT || 8080
app.listen(port, () => {
console.log(`Listening on port ${port}`)
})
我感觉在尝试连接到远程服务器时 GCP 超时,但我没有在网上找到任何资源来帮助我调试它。有人遇到过这种问题吗?
如果我们查看错误消息,我们会发现它正在尝试连接到端口 25 上的外部服务。Google always 阻止对端口的出站请求25. 您可以在此页面找到此文档和相关替代方案:
Sending email from an instance
此外,here 是一个很好的搜索查询(在 Whosebug 上),可以搜索类似的问题和答案。
我遇到了以下问题:
Error: connect ETIMEDOUT 209.85.234.27:25
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1159:16) {
当 运行 GCP 上的以下代码(Cloud Functions 和 Cloud 运行 都失败)时:
const verifier = require('email-verify')
const express = require('express')
const app = express()
/**
* Verify an email address
*/
app.post('/verify', async (request, response, _next) => {
const email = request.query.email
console.log(`Verifying ${email}`)
const isValid = await new Promise(function (resolve, _reject) {
if (!email || typeof email !== 'string') {
return resolve(false)
}
verifier.verify(email, function (err, info) {
if (err) {
console.error(err)
return resolve(false)
}
return resolve(info.success)
})
})
response.json({ valid: isValid, email: typeof email === 'string' ? email : '' })
})
const port = process.env.PORT || 8080
app.listen(port, () => {
console.log(`Listening on port ${port}`)
})
我感觉在尝试连接到远程服务器时 GCP 超时,但我没有在网上找到任何资源来帮助我调试它。有人遇到过这种问题吗?
如果我们查看错误消息,我们会发现它正在尝试连接到端口 25 上的外部服务。Google always 阻止对端口的出站请求25. 您可以在此页面找到此文档和相关替代方案:
Sending email from an instance
此外,here 是一个很好的搜索查询(在 Whosebug 上),可以搜索类似的问题和答案。