Regarding auth, I configured only sign in with Google, which works and I am able to create a user object in DynamoDB. As a second step I was trying to update a field in the object using:
The user object has all the fields according to the schema + the owner field, as specified in the documentation as well. When calling the above I catch the error: TypeError: Cannot read property 'isReadOnly' of undefined]
I started debugging and found the issue. Inside APIClient.ts there is this code:
It seems the issue is that the arg object has all the fields from the schema + the owner field, but the fields object has only the fields from the schema. So when the filter function is called for each element, it reaches the point where it tries to access fields.owner.isReadOnly, where fields.owner is undefined because owner is not part of the schema.
So, am I doing something wrong? Have I missed something in the documentation or is it an issue?
Before opening, please confirm:
JavaScript Framework
React Native
Amplify APIs
DataStore
Amplify Version
v6
Amplify Categories
No response
Backend
Amplify Gen 2 (Preview)
Environment information
Describe the bug
Hi,
I just started experimenting with AWS Amplify and I'm struggling with an error about authorizing an update in DynamoDB.
Expected behavior
I was expecting a successful update.
Reproduction steps
So, my defined backend looks like this:
Regarding auth, I configured only sign in with Google, which works and I am able to create a user object in DynamoDB. As a second step I was trying to update a field in the object using:
The user object has all the fields according to the schema + the owner field, as specified in the documentation as well. When calling the above I catch the error:
TypeError: Cannot read property 'isReadOnly' of undefined]
I started debugging and found the issue. Inside APIClient.ts there is this code:
It seems the issue is that the
arg
object has all the fields from the schema + the owner field, but thefields
object has only the fields from the schema. So when the filter function is called for each element, it reaches the point where it tries to accessfields.owner.isReadOnly
, wherefields.owner
is undefined becauseowner
is not part of the schema.So, am I doing something wrong? Have I missed something in the documentation or is it an issue?
If you need more details, let me know.
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