hicetnunc2000 / hicetnunc-api

serverless express API gathering dApp data with api.better-call.dev and conseil.js
74 stars 47 forks source link

Large collections cause `/tz/:wallet` to return 429 error #53

Open skenaja opened 3 years ago

skenaja commented 3 years ago

(From https://github.com/hicetnunc2000/hicetnunc/issues/522)

curl --location --request POST 'localhost:3001/tz' \
--header 'Content-Type: application/json' \
--data-raw '{"tz":"tz1Pu8zRmNghAHzWxsT9Cy2qXHxkCrHcB3vc"}'
Error: Request failed with status code 429
   at createError (/home/alex/hicetnunc-api/node_modules/axios/lib/core/createError.js:16:15)
   at settle (/home/alex/hicetnunc-api/node_modules/axios/lib/core/settle.js:17:12)
   at IncomingMessage.handleStreamEnd (/home/alex/hicetnunc-api/node_modules/axios/lib/adapters/http.js:260:11)
   at IncomingMessage.emit (events.js:326:22)
   at endReadableNT (_stream_readable.js:1241:12)
   at processTicksAndRejections (internal/process/task_queues.js:84:21)
skenaja commented 3 years ago

This error is caused by cloudflare-ipfs rate limiting large numbers of requests when the /tz call requests IPFS metadata https://github.com/hicetnunc2000/hicetnunc-api/blob/master/lib/utils.js#L21

This needs to be replaced with a call for metadata from mongodb.

skenaja commented 3 years ago

Another example of a failing wallet ID is tz1gsrd3CfZv4BfPnYKq5pKpHGFVdtGCgd71

alexcartagenamex commented 3 years ago

Hi. I haven´t bee able to see my page all day. It worked fine until yesterday night. It has 200 images up. Help. https://www.hicetnunc.xyz/tz/tz1XtMdVnBuLiQQN1vSQN7b5tWtu3NqC4Wna

TRIGOMUSIC commented 3 years ago

Hi. I haven´t bee able to see my page all day. It worked fine until yesterday night. It has 200 images up. Help. https://www.hicetnunc.xyz/tz/tz1XtMdVnBuLiQQN1vSQN7b5tWtu3NqC4Wna

I am dealing with this exact issue. None of my purchased objkts are loading in my Collection page https://www.hicetnunc.xyz/TRIGO/collection

My wallet address has the objkts I purchased so I'm not sure what is going wrong https://tzkt.io/tz1aqb6BSzXxVJsgkSc2F5v79NMgezNzCjbP/operations/