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

App crashes when JWT token expired before it retried to refresh it on init #565

Open
buuuudzik opened this issue Jul 25, 2024 · 5 comments

Comments

@buuuudzik
Copy link

buuuudzik commented Jul 25, 2024

We are using the Iterable SDK in our project, currently at version 1.3.19:
"@iterable/react-native-sdk": "1.3.19",

Recently, we have encountered errors in production, which I have also been able to reproduce in development mode. It appears that if the app is left logged in and then fully closed for a period longer than the JWT token expiration time, the Iterable SDK does not attempt to refresh the token before using it. This results in a complete app crash, and we have no means to prevent it.

Could you ensure that your SDK cannot cause the app to crash entirely? There should be an error handler to allow us to check what happened in the SDK without encountering an unmanageable low-level error.

Additionally, it would be helpful if we could pass a new auth token via Iterable.setEmail(email, token) while still utilizing the auto-refresh mechanism. Currently, when we pass the token using the mentioned method, the auto-refresh mechanism stops working.

Here is the error we found that causes the app to crash completely:
CleanShot 2024-07-25 at 15 57 19

@jena-chakour
Copy link

Hi @buuuudzik, thanks for sharing -- I've reached out through your Support ticket for additional details; please share the full crash log and device info. We will look into this :)

@buuuudzik
Copy link
Author

Below you can find the whole crashlog from BugSnag from the production:

java.lang.RuntimeException: An error occurred while executing doInBackground()
        at android.os.AsyncTask$4.done(AsyncTask.java:399)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:383)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:252)
        at java.util.concurrent.FutureTask.run(FutureTask.java:271)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:929)

Caused by: java.lang.AbstractMethodError: abstract method "void com.iterable.iterableapi.IterableAuthHandler.onAuthFailure(com.iterable.iterableapi.AuthFailure)"
        at com.iterable.iterableapi.IterableAuthManager.handleAuthFailure(IterableAuthManager.java:176)
        at com.iterable.iterableapi.IterableRequestTask.executeApiRequest(IterableRequestTask.java:193)
        at com.iterable.iterableapi.IterableRequestTask.doInBackground(IterableRequestTask.java:61)
        at com.iterable.iterableapi.IterableRequestTask.doInBackground(IterableRequestTask.java:34)
        at android.os.AsyncTask$3.call(AsyncTask.java:378)
        at java.util.concurrent.FutureTask.run(FutureTask.java:266)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:289)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1167)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:929)

@buuuudzik
Copy link
Author

If it's about a device, it can be reproduced on every Android phone, we detected it also on OS version from Android 10 to 14. Personally I'm using for tests Samsung Note 10 Plus.

@buuuudzik
Copy link
Author

In our case it looks that this helps (no crash and lib can continue fetching new JWT token and sending events):
CleanShot 2024-07-27 at 08 18 58@2x

@buuuudzik
Copy link
Author

Maybe it's related with this issue:
Iterable/iterable-android-sdk#741

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