ton-connect / sdk

SDK for TON Connect 2.0 — a comprehensive communication protocol between wallets and apps in TON ecosystem
Apache License 2.0
165 stars 40 forks source link

[Backend NodeJS]: 429 error code, unable to fix it - no functionality #149

Open imartemy1524 opened 2 months ago

imartemy1524 commented 2 months ago

Describe the bug

I'm using @tonconnect/sdk in my telegram chatbot (on backend) to authorize telegram users. Everything was great, until my bot was published in 1.5M telegram channel, s.t. right now it comes with 30RPS. The claim: bridge.tonapi.io, which is used in TonKeeper (the most popular wallet in TON) has Flood Control on theirs' servers, because of which my bot was banned. I wrote them, and they gave me token for Authorization header, BUT, I'm unable to put it inside your library: no functionality.

So I had to patch JS code, and I think, that it is not the best way for things to work.

Expected behavior

Add ability to send custom headers with your fetch requests (for example, authorization) on the servers, OR, create smth like DEV apps on the bridge side, s.t. this situation won't happen anymore.

Current behavior

I'm unable to send any headers any other way then patching the source code. Right know it is not really popular issue, but if the TON community grew, then it would be a big problem.

Steps to Reproduce

  1. Run a chat bot with 10RPS.
  2. Send QR code for each user (from your backed) to authorize him in tonkeeper
  3. Get the flood control error
  4. Send the message to develepers, get the Authorization header and realize, that the only way to work with it - "inject" it in the source code of your library.

Environment

├─┬ @ton/blueprint@0.19.1 │ └─┬ @tonconnect/sdk@2.2.0 │ ├── @tonconnect/isomorphic-eventsource@0.0.1 │ ├── @tonconnect/isomorphic-fetch@0.0.2 │ └── @tonconnect/protocol@2.2.6 deduped └─┬ @tonconnect/sdk@3.0.0 ├── @tonconnect/isomorphic-eventsource@0.0.2 ├── @tonconnect/isomorphic-fetch@0.0.3 └── @tonconnect/protocol@2.2.6

Additional context

:)