🐛 Bug Report: Crash when trying to createRow with transaction
まだ誰も着手していません。
評価
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 初心者へのやさしさ
- 52/100
調査の方向性
Row.kt のメソッドと報告された行で失敗しているキャストから始め、TablesDb.kt の createRow レスポンスの変換を追跡します。トランザクションの場合を再現し、$createdAt または $updatedAt なしで行を作成できることを確認するとともに、非トランザクションの場合が引き続き動作することを確認します。
索引モデルが issue の本文から書いたものです。
説明
👟 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
- 主要言語
- Kotlin
- スター
- 156
- フォーク
- 29
- 平均マージ
- 8時間 49分
- マージ済み PR(30日)
- 5
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
appwrite/sdk-for-android のほかの issue
-
Realtime messages can come out of order (and in fact are processed in parallel)再び着手できるかも @ChiragAgg5k が 267 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
appwrite/sdk-for-android#103 · 担当者 1 名 ·
-
Realtime does not get notified or retry socket failures correctly再び着手できるかも @ChiragAgg5k が 267 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
appwrite/sdk-for-android#101 · 担当者 1 名 ·
-
Support mTLS再び着手できるかも @ChiragAgg5k が 267 日前に担当しましたが、オープン中のプルリクエストはありません。 オープン
appwrite/sdk-for-android#100 · コメント 1 件 · 担当者 1 名 ·
-
難易度 5/5 1週間以上 初心者へのやさしさ 25/100
appwrite/sdk-for-android#99 · コメント 1 件 · リアクション 1 件 ·
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
appwrite/sdk-for-android#80 · コメント 1 件 ·
appwrite/sdk-for-android の issue をすべて見る
似ている issue
-
Unified account interface not translated into Simplified Chinese対応中かも @xuenhua が 2 日前に担当しました。 オープンunconfirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
thunderbird/thunderbird-android#11936 · コメント 1 件 ·
メンテナーはふだん 3 日以内に返信
-
Update toast stylingオープンdesign good first issue help wanted
難易度 2/5 1〜3時間 初心者へのやさしさ 73/100
scribe-org/Scribe-Android#778 ·
メンテナーはふだん 1 日以内に返信
-
Needs Triage
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
ankidroid/Anki-Android#23392 ·
メンテナーはふだん 1 日以内に返信
-
AI Generated CI/CD ⚒️ Flaky-tests 🐦 go 🏃
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
valkey-io/valkey-glide#7772 ·
メンテナーはふだん 1 日以内に返信
-
Error Handling Swift
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
Automattic/wordpress-rs#1759 ·
メンテナーはふだん 1 日以内に返信