raydium-io / raydium-sdk-V2

Open-source Typescript SDK for Raydium
GNU General Public License v3.0
38 stars 38 forks source link

call Raydium.api.fetchPoolById({ ids: pool_id }) timeout #9

Closed tacshi closed 3 months ago

tacshi commented 3 months ago

error like this:

2024-06-18 18:53:35,204 ERROR 73552 [-/127.0.0.1/e7ef3ac1-1b0b-4ce0-9230-1fc6a8e7e98b/12660ms POST /solana/raydium/cpmm] nodejs.AxiosError: timeout of 10000ms exceeded at RedirectableRequest.handleRequestTimeout (/Users/xxx/Code/xxx/web3_quoter/node_modules/axios/lib/adapters/http.js:647:16) at RedirectableRequest.emit (node:events:514:28) at RedirectableRequest.emit (node:domain:488:12) at Timeout.<anonymous> (/Users/xxx/Code/xxx/web3_quoter/node_modules/follow-redirects/index.js:210:12) at listOnTimeout (node:internal/timers:573:17) at processTimers (node:internal/timers:514:7) at Axios.request (/Users/xxx/Code/xxx/web3_quoter/node_modules/axios/lib/core/Axios.js:45:41) at async Gr.fetchPoolById (/Users/xxx/Code/xxx/web3_quoter/node_modules/@raydium-io/raydium-sdk-v2/src/api/api.ts:195:17) at async RaydiumController.cpmm (/Users/xxx/Code/xxx/web3_quoter/app/controller/solana/raydium.ts:154:22) at async /Users/xxx/Code/xxx/web3_quoter/app/middleware/recover.ts:6:7 at async /Users/xxx/Code/xxx/web3_quoter/node_modules/egg-development/app/middleware/egg_loader_trace.js:9:50 at async xframe (/Users/xxx/Code/xxx/web3_quoter/node_modules/egg-security/lib/middlewares/xframe.js:7:5) at async xssProtection (/Users/xxx/Code/xxx/web3_quoter/node_modules/egg-security/lib/middlewares/xssProtection.js:7:5) at async nosniff (/Users/xxx/Code/xxx/web3_quoter/node_modules/egg-security/lib/middlewares/nosniff.js:8:5) at async noopen (/Users/xxx/Code/xxx/web3_quoter/node_modules/egg-security/lib/middlewares/noopen.js:8:5) at async session (/Users/xxx/Code/xxx/web3_quoter/node_modules/koa-session/index.js:41:7) message: "timeout of 10000ms exceeded" name: "AxiosError" code: "ECONNABORTED" config: {"transitional":{"silentJSONParsing":true,"forcedJSONParsing":true,"clarifyTimeoutError":false},"adapter":["xhr","http"],"transformRequest":[null],"transformResponse":[null],"timeout":10000,"xsrfCookieName":"XSRF-TOKEN","xsrfHeaderName":"X-XSRF-TOKEN","maxContentLength":-1,"maxBodyLength":-1,"env":{},"headers":{"Accept":"application/json, text/plain, */*","User-Agent":"axios/1.6.8","Accept-Encoding":"gzip, compress, deflate, br"},"baseURL":"https://api-v3.raydium.io","method":"get","url":"/pools/info/ids?ids=CnoKYnj3GNdTxQfKKBxmq33rJMShyt3eC1zWGgfptzkT"} request: {"_writableState":{"highWaterMark":16384,"length":0,"corked":0,"writelen":0,"bufferedIndex":0,"pendingcb":0},"_events":{"socket":[null,null]},"_eventsCount":3,"_options":{"maxRedirects":21,"maxBodyLength":null,"protocol":"https:","path":"/pools/info/ids?ids=CnoKYnj3GNdTxQfKKBxmq33rJMShyt3eC1zWGgfptzkT","method":"GET","headers":{"Accept":"application/json, text/plain, */*","User-Agent":"axios/1.6.8","Accept-Encoding":"gzip, compress, deflate, br"},"agents":{},"beforeRedirects":{},"hostname":"api-v3.raydium.io","port":"","nativeProtocols":{"http:":{"METHODS":["ACL","BIND","CHECKOUT","CONNECT","COPY","DELETE","GET","HEAD","LINK","LOCK","M-SEARCH","MERGE","MKACTIVITY","MKCALENDAR","MKCOL","MOVE","NOTIFY","OPTIONS","PATCH","POST","PROPFIND","PROPPATCH","PURGE","PUT","REBIND","REPORT","SEARCH","SOURCE","SUBSCRIBE","TRACE","UNBIND","UNLINK","UNLOCK","UNSUBSCRIBE"],"STATUS_CODES":{"100":"Continue","101":"Switching Protocols","102":"Processing","103":"Early Hints","200":"OK","201":"Created","202":"Accepted","203":"Non-Authoritative Information","204":"No Content","205":"Reset Content","206":"Partial Content","207":"Multi-Status","208":"Already Reported","226":"IM Used","300":"Multiple Choices","301":"Moved Permanently","302":"Found","303":"See Other","304":"Not Modified","305":"Use Proxy","307":"Temporary Redirect","308":"Permanent Redirect","400":"Bad Request","401":"Unauthorized","402":"Payment Required","403":"Forbidden","404":"Not Found","405":"Method Not Allowed","406":"Not Acceptable","407":"Proxy Authentication Required","408":"Request Timeout","409":"Conflict","410":"Gone","411":"Length Required","412":"Precondition Failed","413":"Payload Too Large","414":"URI Too Long","415":"Unsupported Media Type","416":"Range Not Satisfiable","417":"Expectation Failed","418":"I'm a Teapot","421":"Misdirected Request","422":"Unprocessable Entity","423":"Locked","424":"Failed Dependency","425":"Too Early","426":"Upgrade Required","428":"Precondition Required","429":"Too Many Requests","431":"Request Header Fields Too Large","451":"Unavailable For Legal Reasons","500":"Internal Server Error","501":"Not Implemented","502":"Bad Gateway","503":"Service Unavailable","504":"Gateway Timeout","505":"HTTP Version Not Supported","506":"Variant Also Negotiates","507":"Insufficient Storage","508":"Loop Detected","509":"Bandwidth Limit Exceeded","510":"Not Extended","511":"Network Authentication Required"},"maxHeaderSize":16384,"globalAgent":{"_events":{},"_eventsCount":2,"defaultPort":80,"protocol":"http:","options":{"keepAlive":true,"scheduling":"lifo","timeout":5000,"noDelay":true,"path":null},"requests":{},"sockets":{},"freeSockets":{},"keepAliveMsecs":1000,"keepAlive":true,"maxSockets":null,"maxFreeSockets":256,"scheduling":"lifo","maxTotalSockets":null,"totalSocketCount":0}},"https:":{"globalAgent":{"_events":{},"_eventsCount":2,"defaultPort":443,"protocol":"https:","options":{"keepAlive":true,"scheduling":"lifo","timeout":5000,"noDelay":true,"path":null},"requests":{},"sockets":{"api-v3.raydium.io:443:::::::::::::::::::::":[{"_tlsOptions":{"pipe":false,"secureContext":{"context":{}},"isServer":false,"requestCert":true,"rejectUnauthorized":true},"_secureEstablished":false,"_securePending":false,"_newSessionPending":false,"_controlReleased":true,"secureConnecting":true,"_SNICallback":null,"servername":null,"alpnProtocol":null,"authorized":false,"authorizationError":null,"encrypted":true,"_events":{"close":[null,null,null,null,null],"end":[null,null,null],"newListener":[null,null],"connect":[null,null,null],"timeout":[null,null,null]},"_eventsCount":12,"connecting":true,"_hadError":false,"_parent":null,"_host":"api-v3.raydium.io","_closeAfterHandlingError":false,"_readableState":{"highWaterMark":16384,"buffer":{"head":null,"tail":null,"length":0},"length":0,"pipes":[],"awaitDrainWriters":null},"_writableState":{"highWaterMark":16384,"length":244,"corked":0,"writelen":244,"bufferedIndex":0,"pendingcb":1},"allowHalfOpen":false,"_sockname":null,"_pendingData":"GET /pools/info/ids?ids=CnoKYnj3GNdTxQfKKBxmq33rJMShyt3eC1zWGgfptzkT HTTP/1.1\r\nAccept: application/json, text/plain, */*\r\nUser-Agent: axios/1.6.8\r\nAccept-Encoding: gzip, compress, deflate, br\r\nHost: api-v3.raydium.io\r\nConnection: keep-alive\r\n\r\n","_pendingEncoding":"latin1","_server":null,"ssl":null,"_requestCert":true,"_rejectUnauthorized":true,"timeout":10000,"parser":{"0":null,"5":null,"6":null,"_headers":[],"_url":"","socket":"~_options~nativeProtocols~https:~globalAgent~sockets~api-v3.raydium.io:443:::::::::::::::::::::~0","incoming":null,"outgoing":{"_events":{},"_eventsCount":7,"outputData":[],"outputSize":0,"writable":true,"destroyed":false,"_last":true,"chunkedEncoding":false,"shouldKeepAlive":true,"maxRequestsOnConnectionReached":false,"_defaultKeepAlive":true,"useChunkedEncodingByDefault":false,"sendDate":false,"_removedConnection":false,"_removedContLen":false,"_removedTE":false,"strictContentLength":false,"_contentLength":0,"_hasBody":true,"_trailer":"","finished":true,"_headerSent":true,"_closed":false,"socket":"~_options~nativeProtocols~https:~globalAgent~sockets~api-v3.raydium.io:443:::::::::::::::::::::~0","_header":"GET /pools/info/ids?ids=CnoKYnj3GNdTxQfKKBxmq33rJMShyt3eC1zWGgfptzkT HTTP/1.1\r\nAccept: application/json, text/plain, */*\r\nUser-Agent: axios/1.6.8\r\nAccept-Encoding: gzip, compress, deflate, br\r\nHost: api-v3.raydium.io\r\nConnection: keep-alive\r\n\r\n","_keepAliveTimeout":0,"agent":"~_options~nativeProtocols~https:~globalAgent","method":"GET","path":"/pools/info/ids?ids=CnoKYnj3GNdTxQfKKBxmq33rJMShyt3eC1zWGgfptzkT","_ended":false,"res":null,"aborted":false,"upgradeOrConnect":false,"parser":"~_options~nativeProtocols~https:~globalAgent~sockets~api-v3.raydium.io:443:::::::::::::::::::::~0~parser","maxHeadersCount":null,"reusedSocket":false,"host":"api-v3.raydium.io","protocol":"https:","_redirectable":"~"},"maxHeaderPairs":2000,"_consumed":false},"_httpMessage":"~_options~nativeProtocols~https:~globalAgent~sockets~api-v3.raydium.io:443:::::::::::::::::::::~0~parser~outgoing","autoSelectFamilyAttemptedAddresses":["88.191.249.183:443","2001::6ca0:a5d3:443"],"handle":{"_parent":{"reading":false,"onconnection":null},"_parentWrap":null,"_secureContext":"~_options~nativeProtocols~https:~globalAgent~sockets~api-v3.raydium.io:443:::::::::::::::::::::~0~_tlsOptions~secureContext","reading":false}}]},"freeSockets":{},"keepAliveMsecs":1000,"keepAlive":true,"maxSockets":null,"maxFreeSockets":256,"scheduling":"lifo","maxTotalSockets":null,"totalSocketCount":1,"maxCachedSessions":100,"_sessionCache":{"map":{},"list":[]}}}},"pathname":"/pools/info/ids","search":"?ids=CnoKYnj3GNdTxQfKKBxmq33rJMShyt3eC1zWGgfptzkT"},"_ended":true,"_ending":true,"_redirectCount":0,"_redirects":[],"_requestBodyLength":0,"_requestBodyBuffers":[],"_currentRequest":"~_options~nativeProtocols~https:~globalAgent~sockets~api-v3.raydium.io:443:::::::::::::::::::::~0~parser~outgoing","_currentUrl":"https://api-v3.raydium.io/pools/info/ids?ids=CnoKYnj3GNdTxQfKKBxmq33rJMShyt3eC1zWGgfptzkT","_timeout":null}

cruzshia commented 3 months ago

do you open any VPNs and could you access https://api-v3.raydium.io/pools/info/ids?ids=CnoKYnj3GNdTxQfKKBxmq33rJMShyt3eC1zWGgfptzkT directly? if not, please provide your ip address so we can check whether your ip is blocked by CDN

tacshi commented 3 months ago

My VPN IP is 103.84.217.32 and I have already set raydium.io to Surge Proxy rule

tacshi commented 3 months ago

Problem solved by enabling Surge's Enhanced Mode 😅

donghanji commented 3 months ago

By proxy agent,like clashx:

image

in config.ts:

import axios from 'axios';
import tunnel from 'tunnel';

// TODO env
// for clashx
const proxy = {
  host: '127.0.0.1',
  port: 7890
};
//
const agent:any = tunnel.httpsOverHttp({
  proxy
});
//
axios.defaults.httpAgent = agent;
axios.defaults.httpsAgent = agent;