2

I used the function provided by metaplex, namely "metaplex.nfts().findAllByCreator()" when the mint data reached thousands, I encountered a problem, namely "ERR_SOCKET_TIMEOUT" (error details below).

how do i solve this? I speculate that this timeout is caused by too much mint data, but metaplx doesn't provide options for pagination, for example, to fetch periodically.

what do I have to do? do you use the native web3 way?

FetchError: request to "https://MY_RPC_XXXXXXXX(im_sensor_this)" failed, reason: Socket timeout
    at ClientRequest.<anonymous> (/home/viandwi24/projects/work/nokiamon/node_modules/.pnpm/[email protected]/node_modules/node-fetch/lib/index.js:1491:11)
    at ClientRequest.emit (node:events:513:28)
    at ClientRequest.emit (node:domain:489:12)
    at TLSSocket.socketErrorListener (node:_http_client:494:9)
    at TLSSocket.emit (node:events:525:35)
    at TLSSocket.emit (node:domain:489:12)
    at emitErrorNT (node:internal/streams/destroy:157:8)
    at emitErrorCloseNT (node:internal/streams/destroy:122:3)
    at processTicksAndRejections (node:internal/process/task_queues:83:21) {
  type: 'system',
  errno: 'ERR_SOCKET_TIMEOUT',
  code: 'ERR_SOCKET_TIMEOUT'
}
1
  • you can use the native way as well and you can use NFT API providers like Helius,shyft and few more about there who indexes this data. If you. specifically want to use the Metaplex JS SDK create an issue on that repo
    – Pratik.js
    Commented Jan 18, 2023 at 15:23

1 Answer 1

5

when you create your connection also pass it an httpAgent: false to bypass the socket timeout from node.

const connection = new Connection('RPC_URL', { httpAgent: false })

An http.Agent that will be used to manage socket connections (eg. to implement connection persistence). Set this to false to create a connection that uses no agent. This applies to Node environments only.

Might also want to look into adding an AbortSignal for it it takes much longer than expected.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.