sdk-for-android icon indicating copy to clipboard operation
sdk-for-android copied to clipboard

🐛 Bug Report: getSession() throwing NullPointerException for sessions being created via email / password

Open SebastianTMo opened this issue 3 years ago • 2 comments

👟 Reproduction steps

Appwrite Version 0.12 / SDK Version 0.3.0 Create a Session via email / password, try to get the session via getSession()

👍 Expected behavior

Get the respective Session

👎 Actual Behavior

NullPointerException due to requiring providerToken not to be nullable. https://github.com/appwrite/sdk-for-android/blob/2d0eecda71f1d85a73f658a9ae08656197e204d4/library/src/main/java/io/appwrite/models/Session.kt#L147 Unfortunately this entry seems to be null when creating a session via email / password.

🎲 Appwrite version

Different version (specify in environment)

💻 Operating system

Linux

🧱 Your Environment

No response

👀 Have you spent some time to check if this issue has been raised before?

  • [X] I checked and didn't find similar issue

🏢 Have you read the Code of Conduct?

SebastianTMo avatar Jan 12 '22 19:01 SebastianTMo

@SebastianTMo Thank your for raising an issue, we will get back to you soon.

lohanidamodar avatar Feb 11 '22 05:02 lohanidamodar

Since it's related to sessions I'll put it here. Appwrite Version 0.13.4.304 SDK Version 0.5.0

I'm attempting to get session by ID or using "current" using var sessionResponse = account.getSession(String) Expected to return a valid Session ID, instead when attempting to parse providerAccessTokenExpiry = (map["providerAccessTokenExpiry"] as Number).toLong() it will throw a NullPointerException java.lang.NullPointerException: null cannot be cast to non-null type kotlin.Number at io.appwrite.models.Session$Companion.from(Session.kt:186) at io.appwrite.services.Account$getSession$converter$1.invoke(Account.kt:787) at io.appwrite.services.Account$getSession$converter$1.invoke(Account.kt:786) at io.appwrite.Client$awaitResponse$2$1.onResponse(Client.kt:498) at okhttp3.internal.connection.RealCall$AsyncCall.run(RealCall.kt:519) 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:764)

Running account.get() beforehand does not change outcome. OS: Ubuntu Server LTS Environment: Set to development with APP_OPTIONS_ABUSE disabled.

SSederberg avatar Apr 23 '22 05:04 SSederberg

This should no longer be an issue with Appwrite 0.14+ 👍

abnegate avatar Sep 09 '22 02:09 abnegate