Telegram-Mini-Apps / telegram-apps

Made from scratch TypeScript packages, examples and documentation you will surely need to start developing on Telegram Mini Apps.
https://docs.telegram-mini-apps.com/
MIT License
691 stars 191 forks source link

After upgrade from 1.x to 2.5.2 cloudStorage stopped working. #535

Closed CodingFu closed 1 week ago

CodingFu commented 2 weeks ago

Platform

Select platforms where this bug is reproducible:

Describe the bug

A clear and concise description of what the bug is.

We used to rely on cloudStorage in v1.x of @telegram-apps/sdk

After upgrading to v2 it claims it's not supported even though telegram mini app version from retrieveLaunchParams() says we are at 7.10

To Reproduce

import { init, retrieveLaunchParams, cloudStorage } from "@telegram-apps/sdk-react" 

init()
console.log(retrieveLaunchParams()) // will report version 7.10
cloudStorage.setItem('foo', 'bar') // will throw Error: ERR_NOT_SUPPORTED

Expected behavior

Cloud storage should be supported (it worked just fine before we upgraded to v2)

heyqbnk commented 2 weeks ago
  1. Check if you have not installed @telegram-apps/sdk and @telegram-apps/sdk-react simultaneously. Only @telegram-apps/sdk-react should be specified in dependencies list
  2. Try logging the Mini Apps version right after calling the init function:
    
    import { init, $version, cloudStorage } from "@telegram-apps/sdk-react" 

init(); console.log($version()); cloudStorage.setItem('foo', 'bar');

CodingFu commented 1 week ago

Thanks for your response. This worked!