-
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
Error saving post TypeError: Cannot read properties of undefined (reading 'version') #9470
Comments
OK. looks like this waas the reason. Why are there 2 other libraries with the same export? Now my problem is At first it worked with Changed to this [REDACTED] |
Now stuck with datastore does not sync with @auth problem. come on. [REDACTED] The project has a deadline and spends 4 hours ( almost every day) on broken amplify. |
This at least sends network requests. But fails
But this does not even send a network request
|
Hey @goldwareJapan 👋 Sorry you're experiencing issues. I would recommend sticking with the DataStore export from the Can you share the contents of the Also, if you can share the contents of your Lastly, please share the response from AppSync in the network tab that includes the Unauthorized error. Just want to see what the full error message says to better understand what might need to be adjusted. Thank you! |
One thing I noticed is that at first your schema was using User Pool groups to authorize access to Project records but in the latest schema it looks like it's been changed to public access. By default DataStore will try to use the default auth type configured for the AppSync resource, defined in the ex.
So - if the model is only authorized for public access, but the AppSync authentication type is set to Cognito User Pools, DataStore will try to make the query to AppSync with an auth mode of Cognito User Pools and that will return an Unauthorized error. That might explain why you're experiencing that issue. You'd either have to log out to be able to query those records or you can adjust the auth rule to something like this in order to grant authenticated users access: type Project1 @model @auth(rules: [ { allow: public }, { allow: private } ]) {
id: ID!
name: String
status: ProjectStatus
# company: String
} Now, in this example there are two types of authorization. Public and Private. Like I said before, by default DataStore will always try to use the default auth type. In order for DataStore to be able to use multiple auth types defined on a model, Multi Auth needs to be enabled. We can do this by setting up our Amplify & DataStore configuration like so:
More information on configuring auth rules for DataStore here: https://docs.amplify.aws/lib/datastore/setup-auth-rules/q/platform/js/#configure-multiple-authorization-types |
Hey @goldwareJapan, please take a look when you can on the above that @chrisbonifacio provided to help with your issue. Apologizes as well that you are having issues with the product but we are here to help the best we can. I do want to state that I did have to redact some of the statements above as we follow a Code of Conduct when providing issues to us. Please let us know if the above helps your case or how we can help further. Thanks ahead of time |
@sammartinez sorry for the bad language. Like I said it was close to the deadline and this happened. We agree with your redact. it was irrelevant to the issue. @chrisbonifacio Thank you for the advice. But we were in hurry so We decided to get data by the script and manually upload it after deleting the whole infrastructure and creating it from scratch. Luckily we had less than a thousand data. Currently, we are in the middle of the process. This time we will avoid Datastore. In long term amplify too. maybe CDK or firebase. Not just because of this issue. Overall amplify have too many basic issues. And looks like all project in AMAZON except So you can close this issue. |
Can we please reopen this. I am experiencing the same error. I am currently trying to create a react-native-windows app from an existing React Native app, which uses Amplify as a backend. One day, the Datastore connection was working, the next, I get the same error message as stated above. Help is urgently needed. I tried the multi-auth solution but it didn't help. |
Okay, so deleting the @aws-amplify/datastore npm package solved the issue. |
I experience the same error |
@entest-hai please open a new issue and fill out the bug report form with your environment info, reproduction steps, code snippets, etc. The cause of this issue could be different for each project. |
This issue has been automatically locked since there hasn't been any recent activity after it was closed. Please open a new issue for related bugs. Looking for a help forum? We recommend joining the Amplify Community Discord server |
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
DataStore
Amplify Categories
storage
Environment information
Describe the bug
DataStore.Query not working.
It was working at the office. I walked home and it gives this error.
Error saving post TypeError: Cannot read properties of undefined (reading 'version')
schema is
code is
I logged in as a admin user
no network request
my indexDB is empty after clicking button ( and error ).
Expected behavior
To load data.
The text was updated successfully, but these errors were encountered: