Skip to content
New issue

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

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

Already on GitHub? # to your account

[UI]: Exception: "Context must be an activity" #310

Open
stefanel96 opened this issue Jan 2, 2025 · 14 comments
Open

[UI]: Exception: "Context must be an activity" #310

stefanel96 opened this issue Jan 2, 2025 · 14 comments
Assignees
Labels
bug Something isn't working

Comments

@stefanel96
Copy link

stefanel96 commented Jan 2, 2025

Describe the bug

This is an exception happening while trying to sign a transaction in TonKeeper on testnet (image attached).

Screenshot 2025-01-02 133230

The mini app is getting this exception thrown, but the transaction is being sent to blockchain and the TON is being billed from the wallet.
I was thinking of just catching this case but that's not the solution.

Expected behavior

TON Connect should return an object containing the BoC with transaction information.

Current behavior

An error "Context must be an activity" is being thrown and frontend is unaware what is the transaction BoC, therefore not able to look for it or to send it to backend to check it, while transaction is being sent from wallet.

Steps to Reproduce

I am not able to reproduce the steps as it's happening on random times.
When it happens, only the phone restart (and reconnecting of the wallet the PC) helps to stop this issue from repeating each time when trying to sign a transaction.
Friend told me that removing of the local storage helped him (which is actually reconnecting of the wallet), but that didn't help me, only restart did.

Environment

It's the latest tonconnect-ui version (2.0.9).

This is happening on all platforms: Android and iOS phones, and PC's (windows 10 and 11).
I am unaware if same thing happens on other wallets or on mainnet, as I am currently testing my mini app.

Additional context

No response

@stefanel96 stefanel96 added the bug Something isn't working label Jan 2, 2025
@lascion
Copy link

lascion commented Jan 3, 2025

I have the same error. This issue occurs probabilistically, making it quite perplexing.

@stefanel96
Copy link
Author

I have the same error. This issue occurs probabilistically, making it quite perplexing.

Are you also using TonKeeper on the testnet?

@stefanel96
Copy link
Author

May I know if anyone is looking at this issue?
@thekiba

@lascion
Copy link

lascion commented Jan 6, 2025

I have the same error. This issue occurs probabilistically, making it quite perplexing.

Are you also using TonKeeper on the testnet?

Yes, tonkeeper testnet

@bc1phugo
Copy link

Same issue here with tonkeeper.

@jobman
Copy link

jobman commented Jan 13, 2025

same issue, try sending transaction using tonconnect (tonutils realisation)
as soon as I enter the application - immediately this error, although it allows me to confirm the transaction

@stefanel96
Copy link
Author

@lascion @jobman @bc1phugo,
May I ask you which frameworks/libraries/languages are you using for building the TMA?
Did you encounter this error on the iOS or Android wallets?

@jobman It does allow to confirm the transaction but the user can also decline the transaction and we would have no way of knowing that, that is the issue.

My guess is:
TonConnect in our app sends a request with Id = 2 and stores that request to match it with the response.
When we switch to the wallet, something goes wrong, and the session gets interrupted.
TonConnect receives a response with Id = 2, but there’s no request to match it with (likely because requests are cleared when the session breaks).
The next time a request is sent with Id = 3, a response for Id = 2 is received instead.

Does anyone knows maybe what can be our next steps in solving this?

@wizidot
Copy link

wizidot commented Jan 16, 2025

Hello, I am also encountering the same problem on Android and iOS. When trying to connect my wallet to Tonkeeper, the transaction fails and returns this error. This issue is relatively recent, as the transactions were going through correctly last week.

@stefanel96
Copy link
Author

Here is the example of the transaction that I am declining, then of the one I am accepting.
Seems like TonKeeper is multiple times returning "Context must be an Acitivity" error but in the end (before the next request) it returns the result of the action (message of cancellation or transaction hash).

Maybe if we can 'catch' all the 'Context' error before the final one, we can get to the final one?
But I am not sure how secure is this approach, as if what happens if the final one never come for some reason and we're left on the 'Context' error?

The one where user declines the transaction:
Image

The one where user accepts the transaction:
Image

@fastesc
Copy link

fastesc commented Jan 16, 2025

Reporting the same issue on mainnet.
@tonconnect/ui 2.0.9, Tonkeeper 5.0.20 (931) for Android

@stefanel96
Copy link
Author

stefanel96 commented Jan 19, 2025

@wizidot @jobman @fastesc @lascion @bc1phugo,
Guys can you answer me on those questions (you can answer only on the questions you have not already in the previous comments)? I am trying to exclude some 'environment variables' in order to reproduce and narrow down the area of the problem, so that I can solve it.

Questions:

  1. What are you using to build your TMA (which framework, library, language)? If you are not using TMA, what are you using TonConnect for?
  2. Do you know how to reproduce this error?
  3. Did you notice any other pattern before this error comes up?
  4. How do you 'stop' this error, because from my experience, when it starts, I must restart both the Telegram app and the TonKeeper app?

Please, add any additional observations if you have, and I'll share new ones from my side too so we can tackle this issue! :)
Cheers

@alim-bilimov
Copy link

I encountered the same problem. Has anyone fixed it?

@stefanel96
Copy link
Author

stefanel96 commented Jan 22, 2025

I encountered the same problem. Has anyone fixed it?

Not that I know of,
can you answer me those questions:

  1. What are you using to build your TMA (which framework, library, language)? If you are not using TMA, what are you using TonConnect for?
  2. Do you know how to reproduce this error?
  3. How do you 'stop' this error, because from my experience, when it starts, I must restart the TonKeeper app? But sometimes, that's not enough and I have to restart my TMA in order to work it out

@AlexandrShulgin
Copy link

AlexandrShulgin commented Jan 23, 2025

I had a similar issue with TMA on React, @tonconnect/ui 2.0.11, Tonkeeper 5.0.20 for Android. Reinstalling Tonkeeper on the phone solved the problem. I'm not sure if this solution will work for everyone, but it might be helpful for someone.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

9 participants