Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"One of the specified object stores was not found." exception when using precaching #1109

Closed
jeffposnick opened this issue Dec 7, 2017 · 5 comments
Labels
Bug An issue with our existing, production codebase. workbox-precaching

Comments

@jeffposnick
Copy link
Contributor

Library Affected:
workbox-precaching

The original details from @beatrizdemiguelperez's report in our Slack channel:

I get this error on workbox-build v3-alpha2

Uncaught (in promise) DOMException: Failed to execute 'transaction' on 'IDBDatabase': One of the specified object stores was not found.
   at result (http://localhost:4200/workbox-v3.0.0-alpha.2/workbox-core.dev.js:1275:32)
    at new Promise (<anonymous>)
    at http://localhost:4200/workbox-v3.0.0-alpha.2/workbox-core.dev.js:1274:28
    at Generator.next (<anonymous>)
    at step (http://localhost:4200/workbox-v3.0.0-alpha.2/workbox-core.dev.js:14:32)
    at http://localhost:4200/workbox-v3.0.0-alpha.2/workbox-core.dev.js:25:15
    at <anonymous>

my generated sw with workbox-build tool is like this

importScripts("workbox-v3.0.0-alpha.2/workbox-sw.js","assets/service-workers/prueba-bea.js");


workbox.setConfig({modulePathPrefix: "workbox-v3.0.0-alpha.2"});
workbox.core.setCacheNameDetails({prefix: "buzz"});

workbox.skipWaiting();
workbox.clientsClaim();


/**
 * The workboxSW.precacheAndRoute() method efficiently caches and responds to
 * requests for URLs in the manifest.
 * See https://goo.gl/S9QRab
 */
self.__precacheManifest = [
  {
    "url": "assets/app.css",
    "revision": "f1126d43afe8da100a141d151020596f"
  },
  {
    "url": "tests/index.html",
    "revision": "d9f6ce3d70c4ebd77f1e9f148df85cd6"
  }
].concat(self.__precacheManifest || []);

if (Array.isArray(self.__precacheManifest)) {
  workbox.precaching.suppressWarnings();
  workbox.precaching.precacheAndRoute(self.__precacheManifest, {});
}

workbox.routing.registerNavigationRoute("/index.html");

before that i was working with v2 and everything was ok

@jeffposnick jeffposnick added Bug An issue with our existing, production codebase. v3 workbox-precaching labels Dec 7, 2017
@jeffposnick
Copy link
Contributor Author

jeffposnick commented Dec 7, 2017

The code associated with the stack trace is

const txn = this._db.transaction(storeNames, type);

Given that service worker code, the only thing that should be touching IndexedDB is workbox.precaching.

The facts that the developer is explicitly calling workbox.core.setCacheNameDetails({prefix: "buzz"}), and that they were moving from v2 to v3, might be relevant with regards to IndexedDB state.

@beatrizdemiguelperez, are you able to reproduce the issue when starting fresh from an Incognito window? And if so, can you deploy your web app at a public URL that we could visit?

@philipwalton
Copy link
Member

It seems likely that a previous version of the IndexedDB database exists with the same name (i.e. one created by Workbox v2 code), so when the v3 Workbox code is running, its onupgradeneeded callback is never invoked, and thus the new object stores aren't created.

Perhaps the issue is here?
https://github.com/GoogleChrome/workbox/blob/09f6340/packages/workbox-precaching/models/PrecachedDetailsModel.mjs#L42-L44

Regardless, if we're using the same DB names from before the DBWrapper helper class was added, we shouldn't be reusing DB versions.

@gauntface
Copy link

I'll dig into this today and try and repro from old to new Workbox. Sounds like just using a new version number and managing the upgrade will be enough.

@beatrizdemiguelperez
Copy link

Hi @gauntface,

As you said from an incognito window it worked with alpha version.

Now i tried these changes on v3 branch and it works perfectly, so bug is fixed.

When will you publish v3 tag or next alpha?

Thanks!!

@jeffposnick
Copy link
Contributor Author

Hello @beatrizdemiguelperez—While this isn't always the case, we try to stick to a bi-weekly release schedule.

As per https://developers.google.com/web/tools/workbox/community#team_calendar, the next release should go out on Thursday.

(During the alpha/beta period, those releases might not always match up, but that's the rough idea.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug An issue with our existing, production codebase. workbox-precaching
Projects
None yet
Development

No branches or pull requests

4 participants