amplify push gives error "Unknown type" when using union or interface in schema - amplify-cli
Describe the bug I defined a schema with a query that returns a type that contains an array of a union object. (see sample below). Everything works when testing locally, no errors. When I run amplify push, everything seems just fine, I get a few minutes of messages about updating things, until the very end, and then:
Unknown type EnrollmentStats for field items. Did you forget to add the @model directive
An error occurred during the push operation: Unknown type EnrollmentStats for field items. Did you forget to add the @model directive
The funny thing is, it does update the stack... I've tried using an interface instead of a union, and the same thing happens.
Amplify CLI Version 4.38.2
To Reproduce some of my schema
type Query {
listEnrollmentStats(
filter: ModelEnrollmentStatsFilterInput!
): ModelEnrollmentStatsConnection @function(name: "myfunction")
}
type ModelEnrollmentStatsConnection {
items: [EnrollmentStats]
}
union EnrollmentStats =
CaseEnrollmentStats
| LocationEnrollmentStats
Expected behavior If it works, it shouldn't give me an error message, it's very disconcerting. I'm worried that something failed to update that I don't know about yet.
2 Answer:
Hi closing this as a dupe and a feature request for the GraphQL transformer v2. https://github.com/aws-amplify/amplify-cli/issues/6217#issuecomment-748530413
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs.
Looking for a help forum? We recommend joining the Amplify Community Discord server *-help
channels for those types of questions.
Read next
- osm install --set arguments should override default flag values Go
- patternProperties interferes with properties - jsonschema-rs
- Bootstrap logo (fa-bootstrap) is out of date - JavaScript Font-Awesome
- Serilog Elasticsearch index name does not get created - serilog-sinks-elasticsearch
- Unable to hide my drawer under screens? - react-navigation
- Authentication question - Ruby google-cloud-ruby
- Allow native SDK options to be specified by user without needing to re-initialize native SDK. - TypeScript sentry-react-native
- [question] 502/499 errors when calling Centrifugo API - centrifugo