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
# Put output below this line
implementation 'com.amplifyframework:core:1.36.1'
implementation 'com.amplifyframework:aws-auth-cognito:1.36.1'
implementation 'com.amplifyframework:aws-api:1.36.1'
implementation 'com.amplifyframework:aws-auth-cognito:1.36.1'
Please include any relevant guides or documentation you're referencing
I tried to follow the tutorial, but I couldn't list the notes items.
After print the query result I found the following error message
'Validation error of type FieldUndefined: Field 'listNoteDatas' in type 'Query' is undefined @ 'listNoteDatas'', locations='[GraphQLLocation{line='2', column='3'}]', path='null', extensions='null'
Checked the query name in AppSync it's 'listNoteData' instead of 'listNoteDatas'.
So I think the Amplify Core and Amplify CLI use different name to build the query. Is there any workaround except manually change the schema in AppSync console?
Reproduction steps (if applicable)
Follow the tutorial,
Create a NoteData schema,
amplify codegen models
Try to list the items
Code Snippet
funqueryNotes() {
Log.i(TAG, "Querying notes")
Amplify.API.query(
ModelQuery.list(NoteData::class.java),
{ response ->Log.i(TAG, "Queried")
Log.i(TAG, response.toString())
if (response.data !=null) {
for (noteData in response.data) {
Log.i(TAG, noteData.name)
// TODO should add all the notes at once instead of one by one (each add triggers a UI refresh)UserData.addNote(UserData.Note.from(noteData))
}
}
},
{ error ->Log.e(TAG, "Query failure", error) }
)
}
Log output
// Put your logs below this line
'Validation error of type FieldUndefined: Field 'listNoteDatas' in type 'Query' is undefined @ 'listNoteDatas'', locations='[GraphQLLocation{line='2', column='3'}]', path='null', extensions='null'
Hello, thank you for reaching out -- we generally advise using the Amplify docs instead of the AWS tutorial you linked to because it's out of date, but it seems like the behavior you are seeing is a bug. If you change the data type from NoteData to something else that doesn't end in Data, is the behavior resolved? The issue might be due to an inconsistent pluralization of Data.
The next steps is to apply the codegen changes, use the closed PR as reference and Swift codegen PR as reference aws-amplify/amplify-codegen#667
@lwang-79 if you are still experience pluralname mismatch, one workaround is to use a different model name that does get plurailzed with s such as Note instead of NoteData
Before opening, please confirm:
Language and Async Model
Kotlin
Amplify Categories
GraphQL API
Gradle script dependencies
// Put output below this line
Environment information
Please include any relevant guides or documentation you're referencing
https://aws.amazon.com/getting-started/hands-on/build-android-app-amplify/module-four/
Describe the bug
I tried to follow the tutorial, but I couldn't list the notes items.
After print the query result I found the following error message
'Validation error of type FieldUndefined: Field 'listNoteDatas' in type 'Query' is undefined @ 'listNoteDatas'', locations='[GraphQLLocation{line='2', column='3'}]', path='null', extensions='null'
Checked the query name in AppSync it's 'listNoteData' instead of 'listNoteDatas'.
So I think the Amplify Core and Amplify CLI use different name to build the query. Is there any workaround except manually change the schema in AppSync console?
Reproduction steps (if applicable)
Follow the tutorial,
Create a NoteData schema,
amplify codegen models
Try to list the items
Code Snippet
Log output
amplifyconfiguration.json
amplifyconfiguration.json.zip
GraphQL Schema
Additional information and screenshots
No response
The text was updated successfully, but these errors were encountered: