You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
DataStore is throwing Failed to execute 'get' on 'IDBIndex': The parameter is not a valid key. when attempting to delete a model that contains a @hasOne relationship that is optional and that relationship is not set on the model being removed.
A patch was released in V5. Please upgrade to aws-amplify@5.0.3 or downgrade to aws-amplify@4.3.37. The patch will be backported to V4 in the next few days.
Before opening, please confirm:
JavaScript Framework
React
Amplify APIs
DataStore
Amplify Categories
No response
Environment information
Describe the bug
DataStore is throwing
Failed to execute 'get' on 'IDBIndex': The parameter is not a valid key.
when attempting to delete a model that contains a@hasOne
relationship that is optional and that relationship is not set on the model being removed.The original error starts here:
amplify-js/packages/datastore/src/storage/adapter/IndexedDBAdapter.ts
Line 911 in b3c507f
However I traced the root of the issue to this block here:
amplify-js/packages/datastore/src/storage/adapter/IndexedDBAdapter.ts
Lines 889 to 890 in b3c507f
It seems that when the relationship is not defined
value
will benull
, makingvalues
equal[null]
.This is a problem for the break condition defined here:
amplify-js/packages/datastore/src/storage/adapter/IndexedDBAdapter.ts
Line 904 in b3c507f
Since
values
being[null]
will not satisfy this condition, as it should.Expected behavior
To be able to delete models with
@hasOne
relationships.Reproduction steps
@hasOne
relationship to another model where the relationship is not required.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: