Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rate Limit Exceeded #12

Open
ledlamp opened this issue Oct 25, 2024 · 13 comments
Open

Rate Limit Exceeded #12

ledlamp opened this issue Oct 25, 2024 · 13 comments

Comments

@ledlamp
Copy link

ledlamp commented Oct 25, 2024

Thought this library was supposed to handle rate limits but I got "Failed to send message(s)." errors after using bot.sendMessages() a bunch of times.

Error: Failed to send message.
    at file:///home/ubuntu/bskychatbot/node_modules/@skyware/bot/dist/bot/Bot.js:971:19
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Bot.sendMessage (file:///home/ubuntu/bskychatbot/node_modules/@skyware/bot/dist/bot/Bot.js:959:26)
    at async Bot.<anonymous> (file:///home/ubuntu/bskychatbot/index.mjs:42:3) {
  [cause]: XRPCError: RateLimitExceeded > Rate Limit Exceeded
      at RateLimitedAgent.request (file:///home/ubuntu/bskychatbot/node_modules/@atcute/client/dist/rpc.js:82:19)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Bot.sendMessage (file:///home/ubuntu/bskychatbot/node_modules/@skyware/bot/dist/bot/Bot.js:959:26)
      at async Bot.<anonymous> (file:///home/ubuntu/bskychatbot/index.mjs:42:3) {
    status: 429,
    kind: 'RateLimitExceeded',
    description: 'Rate Limit Exceeded',
    headers: {
      'access-control-allow-origin': '*',
      'cache-control': 'private',
      'content-length': '61',
      'content-type': 'application/json; charset=utf-8',
      date: 'Fri, 25 Oct 2024 20:59:10 GMT',
      etag: 'W/"3d-egyFOcXCrKQFzoI7522/4+PpxIk"',
      'keep-alive': 'timeout=90',
      'ratelimit-limit': '3000',
      'ratelimit-policy': '3000;w=300',
      'ratelimit-remaining': '2902',
      'ratelimit-reset': '1729889985',
      'strict-transport-security': 'max-age=63072000',
      vary: 'Authorization, Accept-Encoding',
      'x-powered-by': 'Express'
    },
    [cause]: undefined
  }
}
@futurGH
Copy link
Contributor

futurGH commented Oct 25, 2024

Are you on 0.3.6? I fixed some ratelimit-related issues in the latest update. If not, try updating and let me know if you still run into this.

@ledlamp
Copy link
Author

ledlamp commented Oct 25, 2024

Yes, it is 0.3.6.

@futurGH
Copy link
Contributor

futurGH commented Oct 26, 2024

Got it, can you try 0.3.7-beta.0 and see if this continues to happen?

@ledlamp
Copy link
Author

ledlamp commented Oct 26, 2024

Still happening

Error: Failed to send messages.
    at file:///home/ubuntu/bskychatbot/node_modules/@skyware/bot/dist/bot/Bot.js:1019:19
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Bot.sendMessages (file:///home/ubuntu/bskychatbot/node_modules/@skyware/bot/dist/bot/Bot.js:1016:26)
    at async Bot.<anonymous> (file:///home/ubuntu/bskychatbot/index.mjs:61:3) {
  [cause]: XRPCError: RateLimitExceeded > Rate Limit Exceeded
      at RateLimitedAgent.request (file:///home/ubuntu/bskychatbot/node_modules/@atcute/client/dist/rpc.js:82:19)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Bot.sendMessages (file:///home/ubuntu/bskychatbot/node_modules/@skyware/bot/dist/bot/Bot.js:1016:26)
      at async Bot.<anonymous> (file:///home/ubuntu/bskychatbot/index.mjs:61:3) {
    status: 429,
    kind: 'RateLimitExceeded',
    description: 'Rate Limit Exceeded',
    headers: {
      'access-control-allow-origin': '*',
      'cache-control': 'private',
      'content-length': '61',
      'content-type': 'application/json; charset=utf-8',
      date: 'Sat, 26 Oct 2024 04:06:11 GMT',
      etag: 'W/"3d-egyFOcXCrKQFzoI7522/4+PpxIk"', 
      'keep-alive': 'timeout=90',
      'ratelimit-limit': '3000',
      'ratelimit-policy': '3000;w=300',
      'ratelimit-remaining': '2995',
      'ratelimit-reset': '1729915865',
      'strict-transport-security': 'max-age=63072000',
      vary: 'Authorization, Accept-Encoding',
      'x-powered-by': 'Express'
    },
    [cause]: undefined
  }
}
Error: Failed to send messages.
    at file:///home/ubuntu/bskychatbot/node_modules/@skyware/bot/dist/bot/Bot.js:1019:19
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Bot.sendMessages (file:///home/ubuntu/bskychatbot/node_modules/@skyware/bot/dist/bot/Bot.js:1016:26)
    at async Bot.<anonymous> (file:///home/ubuntu/bskychatbot/index.mjs:61:3) {
  [cause]: XRPCError: RateLimitExceeded > Rate Limit Exceeded
      at RateLimitedAgent.request (file:///home/ubuntu/bskychatbot/node_modules/@atcute/client/dist/rpc.js:82:19)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Bot.sendMessages (file:///home/ubuntu/bskychatbot/node_modules/@skyware/bot/dist/bot/Bot.js:1016:26)
      at async Bot.<anonymous> (file:///home/ubuntu/bskychatbot/index.mjs:61:3) {
    status: 429,
    kind: 'RateLimitExceeded',
    description: 'Rate Limit Exceeded',
    headers: {
      'access-control-allow-origin': '*',
      'cache-control': 'private',
      'content-length': '61',
      'content-type': 'application/json; charset=utf-8',
      date: 'Sat, 26 Oct 2024 04:06:11 GMT',
      etag: 'W/"3d-egyFOcXCrKQFzoI7522/4+PpxIk"',
      'keep-alive': 'timeout=90',
      'ratelimit-limit': '3000',
      'ratelimit-policy': '3000;w=300',
      'ratelimit-remaining': '2994',
      'ratelimit-reset': '1729915865',
      'strict-transport-security': 'max-age=63072000',
      vary: 'Authorization, Accept-Encoding',
      'x-powered-by': 'Express'
    },
    [cause]: undefined
  }
}

@futurGH
Copy link
Contributor

futurGH commented Oct 26, 2024

Weird, I'll have to see if I can reproduce.

@futurGH
Copy link
Contributor

futurGH commented Oct 27, 2024

Can you give beta.1 a shot? Apologies, this is tough to pin down.

@futurGH
Copy link
Contributor

futurGH commented Nov 1, 2024

Fix is published in 0.3.7, let me know if you continue to run into this.

@futurGH futurGH closed this as completed Nov 1, 2024
@ledlamp
Copy link
Author

ledlamp commented Nov 4, 2024

Happened again

2024-11-04T20:52:52.712Z,did:plc:icwasmy7mggrjaw4k5yam2nt,luizzeroxis,luizzeroxis.bsky.social,that before might not happen because you could assume people didnt see the thin
g at all at least
Error: Failed to send messages.
    at file:///home/ubuntu/bskychatbot/node_modules/@skyware/bot/dist/bot/Bot.js:1017:19
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Bot.sendMessages (file:///home/ubuntu/bskychatbot/node_modules/@skyware/bot/dist/bot/Bot.js:1014:26)
    at async Bot.<anonymous> (file:///home/ubuntu/bskychatbot/index.mjs:94:3) {
  [cause]: XRPCError: RateLimitExceeded > Rate Limit Exceeded
      at RateLimitedAgent.request (file:///home/ubuntu/bskychatbot/node_modules/@atcute/client/dist/rpc.js:82:19)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Bot.sendMessages (file:///home/ubuntu/bskychatbot/node_modules/@skyware/bot/dist/bot/Bot.js:1014:26)
      at async Bot.<anonymous> (file:///home/ubuntu/bskychatbot/index.mjs:94:3) {
    status: 429,
    kind: 'RateLimitExceeded',
    description: 'Rate Limit Exceeded',
    headers: {
      'access-control-allow-origin': '*',
      'cache-control': 'private',
      'content-length': '61',
      'content-type': 'application/json; charset=utf-8',
      date: 'Mon, 04 Nov 2024 20:52:56 GMT',
      etag: 'W/"3d-egyFOcXCrKQFzoI7522/4+PpxIk"',
      'keep-alive': 'timeout=90',
      'ratelimit-limit': '3000',
      'ratelimit-policy': '3000;w=300',
      'ratelimit-remaining': '2950',
      'ratelimit-reset': '1730753700',
      'strict-transport-security': 'max-age=63072000',
      vary: 'Authorization, Accept-Encoding',
      'x-powered-by': 'Express'
    },
    [cause]: undefined
  }
}
Error: Failed to send message.
    at file:///home/ubuntu/bskychatbot/node_modules/@skyware/bot/dist/bot/Bot.js:968:19
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Bot.sendMessage (file:///home/ubuntu/bskychatbot/node_modules/@skyware/bot/dist/bot/Bot.js:956:26) {
  [cause]: XRPCError: RateLimitExceeded > Rate Limit Exceeded
      at RateLimitedAgent.request (file:///home/ubuntu/bskychatbot/node_modules/@atcute/client/dist/rpc.js:82:19)
      at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
      at async Bot.sendMessage (file:///home/ubuntu/bskychatbot/node_modules/@skyware/bot/dist/bot/Bot.js:956:26) {
    status: 429,
    kind: 'RateLimitExceeded',
    description: 'Rate Limit Exceeded',
    headers: {
      'access-control-allow-origin': '*',
      'cache-control': 'private',
      'content-length': '61',
      'content-type': 'application/json; charset=utf-8',
      date: 'Mon, 04 Nov 2024 20:52:56 GMT',
      etag: 'W/"3d-egyFOcXCrKQFzoI7522/4+PpxIk"',
      'keep-alive': 'timeout=90',
      'ratelimit-limit': '3000',
      'ratelimit-policy': '3000;w=300',
      'ratelimit-remaining': '2949',
      'ratelimit-reset': '1730753700',
      'strict-transport-security': 'max-age=63072000',
      vary: 'Authorization, Accept-Encoding',
      'x-powered-by': 'Express'
    },
    [cause]: undefined
  }
}

Version was 0.3.7-beta.1, but it's the same right?

@futurGH
Copy link
Contributor

futurGH commented Nov 4, 2024

Weird, the headers indicate you've still got 2950 requests remaining. What's the other process running on your server (i.e. is it also running @skyware bot? Is it only using chat endpoints or others as well?)

@futurGH futurGH reopened this Nov 4, 2024
@ledlamp
Copy link
Author

ledlamp commented Nov 5, 2024

it's running in my house so the other client would be me using the bluesky chat

@ledlamp
Copy link
Author

ledlamp commented Nov 14, 2024

Actually, I'm on a different network with different IP so it must be just the bot but it still happens.

I'm using .sendMessages() with more than a dozen people, could it be that this rate limit is for the individual messages and not the HTTP requests? https://gitea.moe/lamp/bluesky-groupchat-bot/src/commit/da34c1012123a6f8d536a24625eec1d8b5cad975/index.mjs#L97

@ledlamp
Copy link
Author

ledlamp commented Nov 23, 2024

Well I don't know, I changed it to use separate sendMessage but it works the same.

2024-11-22_22-35-43 203_ubuntu@dev_~

I don't understand these ratelimit headers.. Policy is 3000 requests per 300 seconds? 2722 remaining? Quota resets in 1732343848 seconds? What?

@futurGH
Copy link
Contributor

futurGH commented Nov 24, 2024

That's a timestamp, not a length of time. Really not sure though, my best guess is that the chat service has its own rate limits that aren't actually being exposed — will need to ask about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants