Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Next.js / Dexie: Failed to execute 'add' on 'IDBObjectStore': Evalu…he object store's key path did not yield a value

When attempting to save using Dexie i encounter the error below, this error strictly occurs in production with no errors occurring when i attempt to save data. Any help much appreciated!

the error:

"Failed to execute 'add' on 'IDBObjectStore': Evaluating the object store's key path did not yield a value.
 DataError: Failed to execute 'add' on 'IDBObjectStore': Evaluating the object store's key path did not yield a value."

db setup

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

db.version(1).stores({
  people: '++id, name',  
});

Add

const newId = await db.people.add({
                name: userName,
                blocks,
                lists,
});

>Solution :

Check in the console for a warning. It might be that the database was created using an alternate primary key (for example ‘id’ without ‘++’) and then you’ve changed the primary key to ‘++id’ after that.

If that is the case, you can delete the database from devtools –> application –> IndexedDB and reload the app.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading