🐛 Bug Report: Crash when trying to createRow with transaction
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức phù hợp với người mới
- 52/100
Hướng nghiên cứu
Bắt đầu với phương thức trong Row.kt và các phép cast bị lỗi tại những dòng được báo cáo, sau đó lần theo quá trình chuyển đổi phản hồi createRow trong TablesDb.kt. Tái hiện trường hợp giao dịch và xác minh rằng có thể tạo một hàng mà không có $createdAt hoặc $updatedAt, trong khi trường hợp không giao dịch vẫn tiếp tục hoạt động.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
👟 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
- Ngôn ngữ chính
- Kotlin
- Star
- 156
- Fork
- 29
- Merge trung bình
- 8 giờ 49 phút
- Pull request đã merge (30 ngày)
- 5
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Đọc hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của appwrite/sdk-for-android
-
Realtime messages can come out of order (and in fact are processed in parallel)Có thể làm lại được @ChiragAgg5k đã nhận 267 ngày trước và không có pull request nào đang mở. Đang mở
appwrite/sdk-for-android#103 · 1 người được giao ·
-
Realtime does not get notified or retry socket failures correctlyCó thể làm lại được @ChiragAgg5k đã nhận 267 ngày trước và không có pull request nào đang mở. Đang mở
appwrite/sdk-for-android#101 · 1 người được giao ·
-
Support mTLSCó thể làm lại được @ChiragAgg5k đã nhận 267 ngày trước và không có pull request nào đang mở. Đang mở
appwrite/sdk-for-android#100 · 1 bình luận · 1 người được giao ·
-
Compose MultiplatformĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
appwrite/sdk-for-android#99 · 1 bình luận · 1 reaction ·
-
🐛 Bug Report: Cookie ErrorĐang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
appwrite/sdk-for-android#80 · 1 bình luận ·
Tất cả issue của appwrite/sdk-for-android
Issue tương tự
-
Unified account interface not translated into Simplified ChineseCó thể đã có người làm @xuenhua đã nhận 2 ngày trước. Đang mởunconfirmed
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
thunderbird/thunderbird-android#11936 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 3 ngày
-
Update toast stylingĐang mởdesign good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
scribe-org/Scribe-Android#778 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Needs Triage
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
ankidroid/Anki-Android#23392 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
AI Generated CI/CD ⚒️ Flaky-tests 🐦 go 🏃
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
valkey-io/valkey-glide#7772 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Error Handling Swift
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Automattic/wordpress-rs#1759 ·
Maintainer thường phản hồi trong vòng 1 ngày