🐛 Bug Report: Crash when trying to createRow with transaction
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 52/100
Línea de trabajo
Comienza con el método de Row.kt y los casts que fallan en las líneas indicadas, y luego sigue la conversión de la respuesta de createRow en TablesDb.kt. Reproduce el caso transaccional y verifica que se pueda crear una fila sin $createdAt ni $updatedAt, mientras que el caso no transaccional sigue funcionando.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
👟 Reproduction steps
The new sdk for Android has a bug when trying to creating a row using a transaction.
Main problem is that the Row is looking for a $createdAt property when, if using a transaction, does not make sense because has not been executed. App crashes on Row.kt in the following lines:
@Suppress("UNCHECKED_CAST")
fun <T> from(
map: Map<String, Any>,
nestedType: Class<T>
) = Row<T>(
id = map["\$id"] as String,
sequence = (map["\$sequence"] as Number).toLong(),
tableId = map["\$tableId"] as String,
databaseId = map["\$databaseId"] as String,
createdAt = map["\$createdAt"] as String,
updatedAt = map["\$updatedAt"] as String,
permissions = map["\$permissions"] as List<String>,
data = map["data"]?.jsonCast(to = nestedType) ?: map.jsonCast(to = nestedType)
)
One possible solution (markeing the fields as nullable) is the following:
data class Row<T>(
/**
* Row ID.
*/
@SerializedName("\$id")
val id: String,
.....
/**
* Row creation date in ISO 8601 format.
*/
@SerializedName("\$createdAt")
val createdAt: String?,
/**
* Row update date in ISO 8601 format.
*/
@SerializedName("\$updatedAt")
val updatedAt: String?,
....
createdAt = map["\$createdAt"] as String?,
updatedAt = map["\$updatedAt"] as String?,
I removed the transaction attribute when debuging the code and it worked perfectly.
👍 Expected behavior
Work as well as if no transaction is place
👎 Actual Behavior
The app crashes, here is the error from the logcat
E FATAL EXCEPTION: OkHttp Dispatcher (Ask Gemini)
Process: com.X.X, PID: 17597
java.lang.NullPointerException: null cannot be cast to non-null type kotlin.String at io.appwrite.models.Row$Companion.from(Row.kt:99)
at io.appwrite.services.TablesDB$createRow$converter$1.invoke(TablesDb.kt:316)
at io.appwrite.services.TablesDB$createRow$converter$1.invoke(TablesDb.kt:314)
at io.appwrite.Client$awaitResponse$2$1.onResponse(Client.kt:602)
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:923)
🎲 Appwrite version
Version 1.8.x
💻 Operating system
Linux
🧱 Your Environment
Appwrite SDK 11.3.0
👀 Have you spent some time to check if this issue has been raised before?
- I checked and didn't find similar issue
🏢 Have you read the Code of Conduct?
- I have read the Code of Conduct
- Lenguaje dominante
- Kotlin
- Estrellas
- 156
- Forks
- 29
- Merge medio
- 8 h 49 min
- PR fusionados (30 d)
- 5
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de appwrite/sdk-for-android
-
Realtime messages can come out of order (and in fact are processed in parallel)Quizá libre de nuevo @ChiragAgg5k la tomó hace 267 días y no hay ningún pull request abierto. Abierto
appwrite/sdk-for-android#103 · 1 asignado ·
-
Realtime does not get notified or retry socket failures correctlyQuizá libre de nuevo @ChiragAgg5k la tomó hace 267 días y no hay ningún pull request abierto. Abierto
appwrite/sdk-for-android#101 · 1 asignado ·
-
Support mTLSQuizá libre de nuevo @ChiragAgg5k la tomó hace 267 días y no hay ningún pull request abierto. Abierto
appwrite/sdk-for-android#100 · 1 comentario · 1 asignado ·
-
Compose MultiplatformAbierto
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
appwrite/sdk-for-android#99 · 1 comentario · 1 reacción ·
-
🐛 Bug Report: Cookie ErrorAbiertobug
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
appwrite/sdk-for-android#80 · 1 comentario ·
Todos los issues de appwrite/sdk-for-android
Issues similares
-
Unified account interface not translated into Simplified ChinesePosiblemente ocupada @xuenhua la tomó hace 2 días. Abiertounconfirmed
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
thunderbird/thunderbird-android#11936 · 1 comentario ·
Los mantenedores suelen responder en 3 días
-
Update toast stylingAbiertodesign good first issue help wanted
Dificultad 2/5 1-3 horas Aptitud para principiantes 73/100
scribe-org/Scribe-Android#778 ·
Los mantenedores suelen responder en 1 día
-
Needs Triage
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
ankidroid/Anki-Android#23392 ·
Los mantenedores suelen responder en 1 día
-
AI Generated CI/CD ⚒️ Flaky-tests 🐦 go 🏃
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
valkey-io/valkey-glide#7772 ·
Los mantenedores suelen responder en 1 día
-
Error Handling Swift
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
Automattic/wordpress-rs#1759 ·
Los mantenedores suelen responder en 1 día