amplify-category-api
amplify-category-api copied to clipboard
DataStore does not support 1 to 1 connection with both sides of connection as optional field
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
v14.21.3
Amplify CLI Version
11.0.5
What operating system are you using?
Pop Os
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
no.
Describe the bug
Our CI/CD fails with message DataStore does not support 1 to 1 connection with both sides of connection as optional field: AdditionalServicePricing.pricing. I have seen this error before too in CI/CD, but that time I also had a issue with package-lock and package.json being in desync, and after fixing that issue this Datastore message also stopped appearing. This message appears also if I run amplify codegen models. We don't use DataStore in this project.
We had many other issues affecting CI/CD, and after fixing them this error started to appear. We are using Transformer V1.
Looking at our build history, these have been failure reasons since the first error to now:
- New environment variable not set *Parameters: [xxx] must have values
- Non-model type pushed with @auth rules *Type ExecutionResult not found
- Non-model type pushed with @auth rules *Type CreatePricingsFromCsvResult not found
- Non-model type pushed with @auth rules *Type ExecutionResult not found
- DataStore does not support 1 to 1 connection with both sides of connection as optional field: AdditionalServicePricing.pricing
Below is the GraphQL schema. If I make AdditionalServicePricing pricing field non-mandatory, build in CI/CD goes through fine. Why does this happen, and why does this error start to show up seemingly out of nowhere? Also local amplify push goes through just fine also with pricing set to mandatory.
type Pricing
@model
@auth(
rules: [
{ allow: private, provider: iam }
{ allow: groups, groupsField: "group" }
]
)
@key(
name: "pricingByGroup"
fields: ["group"]
queryField: "pricingByGroup"
) {
id: ID!
name: String!
group: String!
elements: [PricingElement!]!
useNextDayPrice: Boolean
tax: Int
_removed: String
}
type AdditionalServicePricing
@model
@auth(
rules: [
{ allow: private, provider: iam }
{ allow: groups, groupsField: "group" }
]
)
@key(name: "byVehicle", fields: ["vehicleId"])
@key(name: "byCategory", fields: ["categoryId"]) {
id: ID!
group: String!
key: String!
vehicleId: ID
categoryId: ID
pricingId: ID!
pricing: Pricing! @connection(fields: ["pricingId"])
}
Expected behavior
The build should succeed with the same schema it has succeeded previously with. Or if it should not, why it has succeeded until now?
Reproduction steps
- Use the attached Schema
- Push and observe Amplify hosting CI/CD fail.
Project Identifier
f59e77335650fce92677ec2970143a9b
Log output
# Put your logs below this line
Additional information
CICD goes fine, if I make the @connection field in question optional.
Before submitting, please confirm:
- [X] I have done my best to include a minimal, self-contained set of instructions for consistently reproducing the issue.
- [X] I have removed any sensitive information from my code snippets and submission.
@phani-srikar any updates on this?
I am still getting error for union type
@arealmaas did you find any solution on this
Would love for y'all to create this functionality. It would seriously simply my scenarios in the future