amplify-category-api
amplify-category-api copied to clipboard
Generates twice the connection ID
How did you install the Amplify CLI?
npm
If applicable, what version of Node.js are you using?
20.6.1
Amplify CLI Version
11.0.5
What operating system are you using?
Mac
Did you make any manual changes to the cloud resources managed by Amplify? Please describe the changes made.
No
Describe the bug
type User @model @auth(rules: [{ allow: private }]) {
id: ID!
name: String
myOrg: Org @hasOne
orgs: [Org] @manyToMany(relationName: "OrgUser")
}
type Org
@model
@auth(
rules: [
{ allow: private, operations: [read] }
{ allow: groups, groups: ["Admins"] }
]
) {
id: ID! @primaryKey(sortKeyFields: ["userID"])
name: String!
userID: ID!
users: [User] @manyToMany(relationName: "OrgUser")
user: User @belongsTo(fields: ["userID"])
}
So if I have this models with the relation ships. It creates for the createUserInput following:
id: ID
name: String
userMyOrgId: ID
userMyOrgUserID: ID
This is related both to the myOrg:Org @hasOne relation. If I remove the entire line, then both userMyOrgId and userMyOrgUserID are gone.
As well for the between model which are created automatically has the same issue.
createOrgUser(condition: ModelOrgUserConditionInputinput: CreateOrgUserInput!): OrgUser
CreateOrgUserInput:
id: ID
userId: ID!
orgId: ID!
orguserID: ID!
And I different problem: So when I add an item in OrgUser. Provide the orgId, orguserID with the orgId and the userId with the userId. And then query the user I got null.
query MyQuery {
getUser(id: "someID") {
orgs {
items {
org {
name
}
}
}
}
}
If I remove the hasOne relation then it works. But this is a common pattern. That a user as one org because he is the owner and user can be part of multiple orgs and org can have multiple user.
Expected behavior
For createUserInput:
id: ID
name: String
userMyOrgUserID: ID
For CreateOrgUserInput:
id: ID
userId: ID!
orgId: ID!
Reproduction steps
Create the model and push it with amplify push -y
Project Identifier
No response
Log output
# Put your logs below this line
Additional information
No response
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.
Hey,👋 thanks for raising this! I'm going to transfer this over to our API repository for better assistance 🙂
Hi @juri-diener, My apologies for the delayed response. Could you provide more details on the relationships between 'user' and 'org'? Can a 'user' be associated with multiple 'orgs'?
Hi @juri-diener, I can reproduce the issue by following the details in the description. Hence, marking this as a bug for the team to evaluate further.
Hi @juri-diener, I can reproduce the issue by following the details in the description. Hence, marking this as a bug for the team to evaluate further.
![]()
Hi, ok that's good any update on this?