-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Amplify DataStore creating data only locally on NextJS API Route #8792
Comments
Hey @casperibo, I would enable logs with |
Hi @iartemiev thank you for your response, i finally could see an error. I think DataStore try to use API key when i try to save data. Normally i would do AUTH_TYPE.AMAZON_COGNITO_USER_POOLS, on API but do i have to declare anything on my DataStore.save command? I faced some error when try to debug. [DEBUG] 20:34.280 DataStore - Mutation failed with authMode: API_KEY If you can look my code again, I'm getting user from withSSRContext and i can console.log current user successfully. |
I console log Auth and Datastore coming from withSSRContext({ req }) and found; Auth._config.aws_appsync_authenticationType is "API_KEY";
DataStore.amplifyConfig.aws_appsync_authenticationType is "API_KEY"; I try to change them but still getting same "Mutation failed with authMode: API_KEY" error. // Didn't work
Auth._config.aws_appsync_authenticationType = "COGNITO_USER_POOLS";
DataStore.amplifyConfig.aws_appsync_authenticationType = "COGNITO_USER_POOLS"; |
Hi @iartemiev can you take a look this situation when you available? I'm still in same situation. |
@chrisbonifacio Hi, i saw your message in a aws-amplify issue page(link below), the problem still didn't fixed. Should i use API in NextJS API routes or is there a way to use DataStore for authenticated requests? |
This will be fixed in #10088 |
We released a fix for this issue in |
Before opening, please confirm:
JavaScript Framework
Next.js
Amplify APIs
DataStore
Amplify Categories
api
Environment information
Describe the bug
Hi i'm using AWS Amplify with DataStore to create fullstack app and i faced a problem that doesn't go away.
I will describe my problem with a basic example.
Schema:
If i try to save a data to the Post model in NextJS API route it will work but if i add
rule like that and try to save a data, the data will create only locally and not properly.
Here is my API route code example:
Expected behavior
The data should be created on cloud like when i adding data without @auth rule.
Reproduction steps
Try to create data on NextJS API route you probably will facing with the same problem.
Code Snippet
// Put your code below this line.
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
The text was updated successfully, but these errors were encountered: