amplify-cli: DataStore does not support connection directive with keyName
Which Category is your question related to? Datastore
Amplify CLI Version 4.18.0
What AWS Services are you utilizing? API, Cognito
Provide additional details e.g. code snippets Following schema used to work. But doesn’t work anymore.
type Blog @model
@auth(rules: [
{allow: owner}
]) {
id: ID!
title: String!
owner: String!
comments: [Comment] @connection(keyName: "byBlog", fields: ["id"])
}
type Comment @model
@auth(rules: [
{allow: owner}
])
@key(name: "byBlog", fields: ["blogID"]) {
id: ID!
owner: String!
content: String!
blogID: ID!
}
Now if I do amplify codegen models I get following error
Error: DataStore does not support connection directive with keyName
My question is “Is this permanant change? or you have plans to support connection directive with keyName for datastore in future?”
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 7
- Comments: 16 (4 by maintainers)
after upgrading amplify CLI to version: @aws-amplify/cli@4.18.1 I received this error: DataStore does not support connection directive with keyName
@apoorvmote
The DataStore client libraries never supported keyName, and model gen did not flag this. We updated the model gen to throw this as an error so that there are no surprises at later at run time. This change is not permanent and we do have plans to support
keyNamein future releasesI updated to Amplify 4.20.0 with the following command. It works
npm i -g @aws-amplify/cli