Closed malaquf closed 6 months ago
Hello, @malaquf 👋. It looks like that error is thrown when a field isn't recognized as a model field, but from what I can tell it looks like your schema definitions for both the Product
model and Attributes
type look proper.
Would you mind sharing the code that's making queries so that we can confirm your attributes
type is being included in them? Are you trying to query any custom selection set or doing anything outside of what the Gen2 docs detail?
Hello, @cwomack. I'm retrieving it through the model like this:
async fetchProduct(id: string) {
return await dataClient.models.Product.get({ id: id })
}
I also tried to add a selection set, but then it also fails here.
For now, I workarounded it by replacing the model query by a graphql query:
async fetchProduct(id: string) {
return await dataClient.graphql({
query: getProduct,
variables: {id: id}
})
}
@malaquf, thank you for the quick response and additional context. We'll mark this as a bug for now and investigate further.
I believe this will be resolved in https://github.com/aws-amplify/amplify-js/pull/12750/files
Before opening, please confirm:
JavaScript Framework
Vue
Amplify APIs
GraphQL API
Amplify Version
v6
Amplify Categories
api
Backend
Amplify Gen 2 (Preview)
Environment information
Describe the bug
Hi! I'm using amplify gen 2 and facing the following issue.
Considering this mode:
the 'attributes' field is not queried when executing:
dataClient.models.Product.get({ id: id })
Only strings and enums of string types are queried, apparently because of the filtering in this method
Trying to retrieve it through a selection set results in a error here.
Expected behavior
All fields from my model are queried by default, independently of their types.
Reproduction steps
Setup the model above and try to get the record using the model as described.
Code Snippet
Log output
aws-exports.js
No response
Manual configuration
No response
Additional configuration
No response
Mobile Device
No response
Mobile Operating System
No response
Mobile Browser
No response
Mobile Browser Version
No response
Additional information and screenshots
No response