tma.js: Async call timeout exceeded. Timeout 100

Platform

Select platforms where this bug is reproducible:

  • Telegram for Android
  • Telegram for iOS
  • Telegram for macOS
  • Telegram Desktop
  • Telegram Web A
  • Telegram Web K

Describe the bug

I am having situations on initialization getting this error: “Async call timeout exceeded. Timeout 100” The same miniapp is working fine in other devices but specially in an android phone I have 2 telegram user and trying switching between them and getting that error 90% of the time when opening the application. In other devices, the application is always opening fine with the same users.

The application is done with next.js, so I am doing async loading.

'use client'

import type { PropsWithChildren } from 'react'
import { SDKProvider } from '@tma.js/sdk-react'

export function TmaSDKLoader({ children }: PropsWithChildren) {
  return (
    <SDKProvider
      options={{
        cssVars: true,
        acceptCustomStyles: true,
        async: true,
      }}
    >
      {children}
    </SDKProvider>
  )
}

To Reproduce

Steps to reproduce the behavior: Do loading process and show error result: const { loading, initResult, error } = useSDKContext()

Expected behavior

Expected to obtain a value on initResult when loading finishes.

About this issue

  • Original URL
  • State: closed
  • Created 6 months ago
  • Comments: 21 (10 by maintainers)

Most upvoted comments

I am currently working on several things:

  1. Increase timeout for viewport creation to make sure, code has enough time to retrieve its data.
  2. Log how much time it took to perform some request. Then, we will know if some request took too much time.

Update will be available in the next several days, so you could try it

And if we have a beta release, maybe @Mergemat can test also his scenario.