You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the request timeout(10s), node Process crashed due to triggerUncaughtException but the catch block logged the error msg expectly (code as example code). Thanks for your reading and work.
When I upgrade axios to 1.3.2, the error was reproduced.
{"level":50,"time":1675693965785,"pid":42,"hostname":"api-7d5f5b8857-jpx52","context":"PythPriceFetcher","msg":"error occurs when getCoinPrice from pyth, pythPriceId=0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d, reason: {\"message\":\"timeout of 10000ms exceeded\",\"name\":\"Error\",\"stack\":\"Error: timeout of 10000ms exceeded at createError (/workspace/api-service/srv/main.cjs:87147:20) at RedirectableRequest.handleRequestTimeout (/workspace/api-service/srv/main.cjs:87815:20)at RedirectableRequest.emit (node:events:513:28)\n at Timeout.<anonymous> (/workspace/api-service/srv/main.cjs:64949:17)\n at listOnTimeout (node:internal/timers:569:17)\n at process.processTimers (node:internal/timers:512:7)\",\"config\":{\"transitional\":{\"silentJSONParsing\":true,\"forcedJSONParsing\":true,\"clarifyTimeoutError\":false},\"transformRequest\":[null],\"transformResponse\":[null],\"timeout\":10000,\"xsrfCookieName\":\"XSRF-TOKEN\",\"xsrfHeaderName\":\"X-XSRF-TOKEN\",\"maxContentLength\":-1,\"maxBodyLength\":-1,\"headers\":{\"Accept\":\"application/json, text/plain, */*\",\"User-Agent\":\"axios/0.26.1\"},\"baseURL\":\"https://xc-mainnet.pyth.network\",\"params\":{\"ids\":[\"0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d\"],\"verbose\":false},\"method\":\"get\",\"url\":\"/api/latest_price_feeds\",\"axios-retry\":{\"retryCount\":0,\"lastRequestTime\":1675693955711}},\"code\":\"ECONNABORTED\",\"status\":null}"}
node:internal/process/promises:288
triggerUncaughtException(err, true /* fromPromise */);
^
Error: timeout of 10000ms exceeded
at createError (/workspace/api-service/srv/main.cjs:87147:20)
at RedirectableRequest.handleRequestTimeout (/workspace/api-service/srv/main.cjs:87815:20)
at RedirectableRequest.emit (node:events:513:28)
at Timeout.<anonymous> (/workspace/api-service/srv/main.cjs:64949:17)
at listOnTimeout (node:internal/timers:569:17)
at process.processTimers (node:internal/timers:512:7) {
config: {
transitional: {
silentJSONParsing: true,
forcedJSONParsing: true,
clarifyTimeoutError: false
},
adapter: [Function: httpAdapter],
transformRequest: [ [Function: transformRequest] ],
transformResponse: [ [Function: transformResponse] ],
timeout: 10000,
xsrfCookieName: 'XSRF-TOKEN',
xsrfHeaderName: 'X-XSRF-TOKEN',
maxContentLength: -1,
maxBodyLength: -1,
validateStatus: [Function: validateStatus],
headers: {
Accept: 'application/json, text/plain, */*',
'User-Agent': 'axios/0.26.1'
},
baseURL: 'https://xc-mainnet.pyth.network',
params: {
ids: [
'0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d'
],
verbose: false
},
method: 'get',
url: '/api/latest_price_feeds',
'axios-retry': { retryCount: 0, lastRequestTime: 1675693955711 },
data: undefined
},
code: 'ECONNABORTED',
_currentUrl: 'https://xc-mainnet.pyth.network/api/latest_price_feeds?ids[]=0xef0d8b6fda2ceba41da15d4095d1da392a0d2f8ed0c6c7bc0f4cfac8c280b56d&verbose=false',
_timeout: null,
[Symbol(kCapture)]: false
},
response: undefined,
isAxiosError: true,
toJSON: [Function: toJSON]
}
Node.js v18.14.0
ELIFECYCLE Command failed with exit code 1.
WARN Local package.json exists, but node_modules missing, did you mean to install?
ELIFECYCLE Command failed with exit code 1.
Example Code
// constructor (It calls axios.create() with timeout config internally)this.aptosPriceConn=newAptosPriceServiceConnection(this.config.config.pythMainnetEndpoint,{timeout: 10000,httpRetries: 0,});// use (Catch the exception)this.aptosPriceConn.getLatestPriceFeeds([pythPriceId]).then((feeds)=>{if(feeds&&feeds.length>0){constpriceCfg=feeds[0].getPriceUnchecked();constp=Big(priceCfg.price).mul(Big(10).pow(priceCfg.expo));if(p.gt(0)){this.logger.debug(`pyth, ${pythPriceId} price = ${p.toString()}`);returnp.toNumber();}}throw`can't fetch price from pyth, pythPriceId=${pythPriceId}`;}).catch((reason)=>{this.logger.error(`error occurs when getCoinPrice from pyth, pythPriceId=${pythPriceId}, reason: %o`,reason,);throwreason;});
Expected behavior
Catch the reject error to prevent node process from crash.
Axios Version
0.26.1
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
18.14.0
OS
Debian 10, amd64 arch
Additional Library Versions
No response
Additional context/Screenshots
No response
The text was updated successfully, but these errors were encountered:
Describe the issue
When the request timeout(10s), node Process crashed due to triggerUncaughtException but the catch block logged the error msg expectly (code as example code). Thanks for your reading and work.
When I upgrade axios to 1.3.2, the error was reproduced.
Example Code
Expected behavior
Axios Version
0.26.1
Adapter Version
No response
Browser
No response
Browser Version
No response
Node.js Version
18.14.0
OS
Debian 10, amd64 arch
Additional Library Versions
No response
Additional context/Screenshots
No response
The text was updated successfully, but these errors were encountered: