Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Failed to execute 'only' on 'IDBKeyRange': The parameter is not a valid key

Tags:

indexeddb

I am fetching data from indexeddb using where class using jsstore.I got response.But getting "Failed to execute 'only' on 'IDBKeyRange': The parameter is not a valid key. " console error.Why I am getting this error.can anyone pls help me.

//Get DBSchema(table & columns)
  private getDbSchema = function () {
    const tblArticle = {
      Name: this._indexedDBLiveDBTableName,
      Columns: [
       {
          Name: 'ParentName',
          NotNull: true,
          DataType: 'string'
        },
        {
          Name: 'ChildName',
          NotNull: true,
          DataType: 'string'
        }
        ,
        {
          Name: 'UpdatedDate',
          NotNull: true,
          DataType: 'string'
        }
      ]
    };

    const Database = {
      Name: this._indexedDBLiveDBName,
      Tables: [tblArticle]
    };
    return Database as any;
  };

 //Fetch articles From IndexedDB
GetArticleFromIndexedDb(section) {
    this._connection.openDb(this._indexedDBLiveDBName);
    return this._connection.select({
      From: this._indexedDBLiveDBTableName,
      Where: {
        ChildName: section
      }
    });
 }

value of section will be like "India","TamilNadu"

Kindly find the attached screenshot for error

here

I am using jsstore 1.3.0

I updated jsstore version to 1.4.1 which is giving "Maximum call stack size exceeded"

enter image description here

Thanks

like image 950
kamalav Avatar asked Mar 08 '23 04:03

kamalav


1 Answers

It is due to the invalid value supplied. IndexedDB support list of value - numbers, dates, strings, binary data, array : which are valid keys.

This error is generally thrown when you are passing - boolean,null or undefined value.

Check out w3c for more info - https://w3c.github.io/IndexedDB/#key-construct

like image 168
Ujjwal Kumar Gupta Avatar answered Apr 07 '23 21:04

Ujjwal Kumar Gupta