TimeoutError: Promise timed out after 90000 milliseconds

See original GitHub issue
  • Telegraf.js Version: 4.3.0
  • Node.js Version: 14.16.1
  • Operating System: win10

Minimal Example Code Reproducing the Issue

image image

I think this happens if you upload large files with slow internet

Expected Behavior

The files must be uploaded to the telegram servers, sent to the user, return the array of uploaded files

Current Behavior

The files were uploaded to the telegram servers, sent to the user. But this error returned. No file array returned. The execution of further code has been abandoned due to an error. image

Error Message and Logs (export DEBUG='telegraf:*')

I do not have

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:22 (1 by maintainers)

github_iconTop GitHub Comments

2reactions
gthrmcommented, Nov 19, 2021

@gthrm Нow will this solve the problem if 1000 users simultaneously hang for 2.5 hours waiting? How to solve the problem globally so that you can just catch this exception?

It’s about “TimeoutError: Promise timed out after 90000 milliseconds”. Not about catch and 1000 users. For example, for 1000 users you can create a queue. And create PR for fix situation with catch. You know?

2reactions
gthrmcommented, Nov 14, 2021

telegraf is using a p-timeout for Promises (https://github.com/telegraf/telegraf/blob/v4/src/telegraf.ts#L232) By default:

const DEFAULT_OPTIONS: Telegraf.Options<Context> = {
  telegram: {},
  handlerTimeout: 90_000, // 90s in ms
  contextType: Context,
}

Use export const bot = new Telegraf(BOT_TOKEN, {handlerTimeout: 9_000_000}); Where handlerTimeout (for example) is 2.5 hours

Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js and Telegraf TimeoutError: Promise timed out after ...
(node:20076) UnhandledPromiseRejectionWarning: TimeoutError: Promise timed out after 90000 milliseconds at Timeout.
Read more >
A brand new website interface for an even better experience!
TimeoutError : Promise timed out after 90000 milliseconds.
Read more >
p-timeout - npm
Returns a decorated input that times out after milliseconds time. It has a .clear() method that clears the timeout. If you pass in...
Read more >
Applying a timeout to your promises
Implementing the timeout​​ The timeout promise, in turn, does nothing but reject in ms milliseconds. As stated in the specification we read above ......
Read more >
.timeout | bluebird
However, if this promise is not fulfilled or rejected within ms milliseconds, the returned promise is rejected with a TimeoutError or the error...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found