Closed ekofi closed 2 years ago
Hi @ekofi 👋 thanks for raising this issue.
Can you also share your graphQL schema for the model?
Hi, thanks @chrisbonifacio. This is the schema:
type Level @model @auth(rules: [{allow: public}]) {
id: ID!
tap_uid: String
value: Float
}
type Flow @model @auth(rules: [{allow: public}]) {
id: ID!
tap_uid: String
value: Float
}
@ekofi sorry, I should've also asked for the code snippets where you are calling DataStore.save
or API.graphql
?. I need to know if it is being called on the client or the server.
Also, can you confirm or share how you're configuring Amplify? I'm curious if you enabled ssr in the configuration.
ex.
Amplify.configure({...awsExports, ssr: true});
Another thing to try is attempt the same mutation in the AppSync console to rule out any platform specific causes.
You mentioned that you are using API Key + IAM, but your schema's auth rules only restrict the models to API Key (allow: public). To setup IAM auth on the model, you would have to adjust the models like so:
type Level @model @auth(rules: [{allow: public}, {allow: public, provider: iam}]) {
id: ID!
tap_uid: String
value: Float
}
type Flow @model @auth(rules: [{allow: public}, {allow: public, provider: iam}]) {
id: ID!
tap_uid: String
value: Float
}
Hi 👋 Closing this as we have not heard back from you. If you are still experiencing this issue and in need of assistance, please feel free to comment and provide us with any information previously requested by our team members so we can re-open this issue and be better able to assist you.
Thank you!
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
GraphQL API
Amplify Categories
api
Environment information
Describe the bug
I created a GraphQL API. I can get the data with await DataStore.query(Model), there is no problem.
But, I can't create a new data with await API.graphql, using mutations.
Also, I CAN create a new data on my LOCAL but not on my Amplify hosting.
GraphQL API has API key auth + IAM as additional auth.
My CloudWatch console:
Expected behavior
I need to create a data with await API.graphql , without a problem in my Amplify console and in "Content" section, I need to able to see my data.
Reproduction steps
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