title: IndexedDB Error : NotFoundError : Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found
body: <p>I have created a IndexedDB setup in my ReactJs PWA.</p>
  <p>The following error is thrown:</p>
  <pre><code>NotFoundError: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.
  </code></pre>
  <p>at line  <code>userSearchDBtx = userSearchDB.transaction(&quot;userdata&quot;,&quot;readwrite&quot;)</code></p>
  <p>My function looks like this:</p>
  <pre class="lang-js prettyprint-override"><code>function Users() {
    let userSearchDB,userSearchDBstore,userSearchDBtx;
    let userDbrequest = window.indexedDB.open(&quot;MyTestDatabase&quot;, 1);
  
  useEffect(()=&gt;{
    if (!window.indexedDB) {
        console.log(&quot;Your browser doesn't support a stable version of IndexedDB. Such and such feature will not be available.&quot;);
    }
  
    else console.log(&quot;IndexedDB supported&quot;)
  
    userDbrequest.onupgradeneeded = function(event) { 
      userSearchDB = event.target.result;
      userSearchDBtx = event.target.transaction;
      userSearchDBstore = userSearchDB.createObjectStore(&quot;userdata&quot;,{keyPath:&quot;uid&quot;})
    };
  
    userDbrequest.onerror = function(event) {
      console.log(&quot;ERROR: &quot; + event.target.errorCode)
    };
  
    userDbrequest.onsuccess = function(event) {
      console.log(&quot;IndexdDb Working&quot;)
      userSearchDB = event.target.result
      userSearchDBtx = userSearchDB.transaction(&quot;userdata&quot;,&quot;readwrite&quot;);
      userSearchDBstore = userSearchDBtx.objectStore(&quot;userdata&quot;);
    };
    //Here also put is unknown
    userSearchDBstore.put({uid:3854238974,phone:3257777,name:&quot;shan&quot;,email:&quot;1@1.com&quot;})
  
  },[])
  
  }
  </code></pre>