从我的 Azure Function 进行大量调用时出现此错误。这个错误是什么意思?如何排除故障?我猜我的 TCP 套接字用完了?我真的不知道如何在功能应用程序菜单中检查它。不过,我检查了 Azure Maps API 的日志,没有错误或掉线的记录,所以我认为这绝对是 axios/function 问题。
我看到了一些添加建议Connection:Keep-Alive
header 甚至创建 axiosinstance
并重复使用它。但是我不确定我的问题是否与此有关。
Error: connect ETIMEDOUT 13.107.42.21:443
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1141:16) { errno: 'ETIMEDOUT', code: 'ETIMEDOUT', syscall: 'connect', address: '13.107.42.21', port: 443, config: {
url: 'https://atlas.microsoft.com/search/fuzzy/json?api-version=1.0&subscription-key= myKey &query=myAddress USA',
method: 'get',
headers: {
Accept: 'application/json, text/plain, */*',
'x-ms-client-id': 'my client ID',
'User-Agent': 'axios/0.19.2'
},
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 0,
adapter: [Function: httpAdapter],
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
validateStatus: [Function: validateStatus],
host: 'atlas.microsoft.com',
data: undefined }, request: Writable {
_writableState: WritableState {
objectMode: false,
highWaterMark: 16384,
finalCalled: false,
needDrain: false,
ending: false,
ended: false,
finished: false,
destroyed: false,
decodeStrings: true,
defaultEncoding: 'utf8',
length: 0,
writing: false,
corked: 0,
sync: true,
bufferProcessing: false,
onwrite: [Function: bound onwrite],
writecb: null,
writelen: 0,
afterWriteTickInfo: null,
bufferedRequest: null,
lastBufferedRequest: null,
pendingcb: 0,
prefinished: false,
errorEmitted: false,
emitClose: true,
autoDestroy: false,
bufferedRequestCount: 0,
corkedRequestsFree: [Object]
},
writable: true,
_events: [Object: null prototype] {
response: [Function: handleResponse],
error: [Function: handleRequestError]
},
_eventsCount: 2,
_maxListeners: undefined,
_options: {
protocol: 'https:',
maxRedirects: 21,
maxBodyLength: 10485760,
path: '/search/fuzzy/json?api-version=1.0&subscription-key= myKey &query=myAddress%20USA',
method: 'GET',
headers: [Object],
agent: undefined,
agents: [Object],
auth: undefined,
hostname: 'atlas.microsoft.com',
port: null,
nativeProtocols: [Object],
pathname: '/search/fuzzy/json',
search: '?api-version=1.0&subscription-key= myKey &query=myAddress%20USA'
},
_redirectCount: 0,
_redirects: [],
_requestBodyLength: 0,
_requestBodyBuffers: [],
_onNativeResponse: [Function],
_currentRequest: ClientRequest {
_events: [Object: null prototype],
_eventsCount: 6,
_maxListeners: undefined,
outputData: [],
outputSize: 0,
writable: true,
_last: true,
chunkedEncoding: false,
shouldKeepAlive: false,
useChunkedEncodingByDefault: false,
sendDate: false,
_removedConnection: false,
_removedContLen: false,
_removedTE: false,
_contentLength: 0,
_hasBody: true,
_trailer: '',
finished: true,
_headerSent: true,
socket: [TLSSocket],
connection: [TLSSocket],
_header: 'GET /search/fuzzy/json?api-version=1.0&subscription-key= myKey &query=myAddress%20USA HTTP/1.1\r\n' +
'Accept: application/json, text/plain, */*\r\n' +
'x-ms-client-id: my client ID\r\n' +
'User-Agent: axios/0.19.2\r\n' +
'Host: atlas.microsoft.com\r\n' +
'Connection: close\r\n' +
'\r\n',
_onPendingData: [Function: noopPendingOutput],
agent: [Agent],
socketPath: undefined,
method: 'GET',
insecureHTTPParser: undefined,
path: '/search/fuzzy/json?api-version=1.0&subscription-key= myKey &query=myAddress%20USA',
_ended: false,
res: null,
aborted: false,
timeoutCb: null,
upgradeOrConnect: false,
parser: null,
maxHeadersCount: null,
reusedSocket: false,
_redirectable: [Circular],
[Symbol(kCapture)]: false,
[Symbol(kNeedDrain)]: false,
[Symbol(corked)]: 0,
[Symbol(kOutHeaders)]: [Object: null prototype]
},
_currentUrl: 'https://atlas.microsoft.com/search/fuzzy/json?api-version=1.0&subscription-key= myKey &query=myAddress%20USA',
[Symbol(kCapture)]: false }, response: undefined, isAxiosError: true, toJSON: [Function] }