You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Please include any relevant guides or documentation you're referencing
No response
Describe the bug
An issue was opened in Amplify Flutter where a user is seeing an exception when running a query with a specific schema. I have created a minimal reproduction of this issue (in flutter). The same schema/query seems to work as expected on iOS (based on my testing).
Reproduction steps (if applicable)
Set up an example DS app with the schema below (can be local only, API is not required)
Add a "Safra" model with a "Talhao" and "Subdivisao"
Query "Safra" models by the "Talhao" ID using a where filter
Observe that the query works
Add a "Safra" model with a "Talhao" but no "Subdivisao"
Query "Safra" models by the "Talhao" ID of the new model using a where filter
Observe that the query throws an exception
Code Snippet
// Put your code below this line.
Log output
// Put your logs below this line
E/amplify:flutter:datastore( 5116): DataStoreException{message=Error in querying the model., cause=java.lang.IllegalStateException: Invalid Primary Key, It should either be single field or of type composite primary key Primary Key.java.lang.NullPointerException, recoverySuggestion=See attached exception for details.}
E/amplify:flutter:datastore( 5116): at com.amplifyframework.datastore.storage.sqlite.SQLiteStorageAdapter.lambda$query$5$com-amplifyframework-datastore-storage-sqlite-SQLiteStorageAdapter(SQLiteStorageAdapter.java:450)
E/amplify:flutter:datastore( 5116): at com.amplifyframework.datastore.storage.sqlite.SQLiteStorageAdapter$$ExternalSyntheticLambda6.run(Unknown Source:10)
E/amplify:flutter:datastore( 5116): at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:463)
E/amplify:flutter:datastore( 5116): at java.util.concurrent.FutureTask.run(FutureTask.java:264)
E/amplify:flutter:datastore( 5116): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1137)
E/amplify:flutter:datastore( 5116): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:637)
E/amplify:flutter:datastore( 5116): at java.lang.Thread.run(Thread.java:1012)
E/amplify:flutter:datastore( 5116): Caused by: java.lang.IllegalStateException: Invalid Primary Key, It should either be single field or of type composite primary key Primary Key.java.lang.NullPointerException
E/amplify:flutter:datastore( 5116): at com.amplifyframework.core.model.ModelIdentifier$Helper.getUniqueKey(ModelIdentifier.java:128)
E/amplify:flutter:datastore( 5116): at com.amplifyframework.core.model.SerializedModel$Builder.serializedData(SerializedModel.java:340)
E/amplify:flutter:datastore( 5116): at com.amplifyframework.datastore.storage.sqlite.SQLiteStorageAdapter.createSerializedModel(SQLiteStorageAdapter.java:900)
E/amplify:flutter:datastore( 5116): at com.amplifyframework.datastore.storage.sqlite.SQLiteStorageAdapter.createSerializedModel(SQLiteStorageAdapter.java:872)
E/amplify:flutter:datastore( 5116): at com.amplifyframework.datastore.storage.sqlite.SQLiteStorageAdapter.lambda$query$5$com-amplifyframework-datastore-storage-sqlite-SQLiteStorageAdapter(SQLiteStorageAdapter.java:444)
E/amplify:flutter:datastore( 5116): ... 6 more
Thank you for the report. I've verified the IllegalStateException happens on the query method exposed for Flutter, but even the native query method does not return data exactly as expected in this scenario.
This issue is now closed. Comments on closed issues are hard for our team to see.
If you need more assistance, please open a new issue that references this one.
Before opening, please confirm:
Language and Async Model
Kotlin
Amplify Categories
DataStore
Gradle script dependencies
// Put output below this line
Environment information
com.amplifyframework:aws-datastore:2.4.1
Please include any relevant guides or documentation you're referencing
No response
Describe the bug
An issue was opened in Amplify Flutter where a user is seeing an exception when running a query with a specific schema. I have created a minimal reproduction of this issue (in flutter). The same schema/query seems to work as expected on iOS (based on my testing).
Reproduction steps (if applicable)
Code Snippet
// Put your code below this line.
Log output
amplifyconfiguration.json
No response
GraphQL Schema
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: