mydea / ember-indexeddb

Utilities & adapter to work with IndexedDB in ember & ember-data
https://mydea.github.io/ember-indexeddb/docs/
MIT License
17 stars 5 forks source link

MissingAPIError: indexedDB API not found when using fastboot #124

Closed oliverlj closed 3 years ago

oliverlj commented 4 years ago

I got this issue after ember-cli-fastboot setup

MissingAPIError: indexedDB API not found. If using IE10+, make sure to run your code on a server URL (not locally). If using old Safari versions, make sure to include indexedDB polyfill.
    at eval (webpack://__ember_auto_import__/./node_modules/dexie/dist/dexie.mjs?:3602:23)
    at executePromiseTask (webpack://__ember_auto_import__/./node_modules/dexie/dist/dexie.mjs?:865:9)
    at new DexiePromise (webpack://__ember_auto_import__/./node_modules/dexie/dist/dexie.mjs?:679:5)
    at dexieOpen (webpack://__ember_auto_import__/./node_modules/dexie/dist/dexie.mjs?:3600:52)
    at Dexie.open (webpack://__ember_auto_import__/./node_modules/dexie/dist/dexie.mjs?:4130:16)
    at openDb (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/addon-tree-output/ember-indexeddb/services/indexed-db.js:765:1)
    at IndexedDbService.setupTask (task) (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/addon-tree-output/ember-indexeddb/services/indexed-db.js:41:1)
    at Generator.next (<anonymous>)
    at Class._resumeGenerator (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/addon-tree-output/ember-concurrency/-task-instance.js:550:1)
    at Class._handleResolvedContinueValue (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/addon-tree-output/ember-concurrency/-task-instance.js:722:1)
    at Class._proceed (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/addon-tree-output/ember-concurrency/-task-instance.js:675:1)
    at Class._scheduleProceed (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/addon-tree-output/ember-concurrency/-task-instance.js:663:1)
    at Class._start (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/addon-tree-output/ember-concurrency/-task-instance.js:330:1)
    at Class._startTaskInstance (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/addon-tree-output/ember-concurrency/-scheduler.js:108:1)
    at Class._flushQueues (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/addon-tree-output/ember-concurrency/-scheduler.js:81:1)
    at Class.schedule (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/addon-tree-output/ember-concurrency/-scheduler.js:63:1)
    at Class._performShared (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/addon-tree-output/ember-concurrency/-task-property.js:377:1)
    at Class.perform (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/addon-tree-output/ember-concurrency/-task-property.js:347:1)
    at ApplicationRoute.beforeModel (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/fz-front-simulator/routes/application.js:31:1)
    at UnresolvedRouteInfoByParam.runBeforeModelHook (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/router_js.js:782:1)
    at /tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/router_js.js:691:1
    at invokeCallback (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/rsvp.js:493:1)
    at publish (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/rsvp.js:476:1)
    at /tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/ember-testing/lib/ext/rsvp.js:19:1
    at invokeWithOnError (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/backburner.js:347:1)
    at Queue.flush (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/backburner.js:229:1)
    at DeferredActionQueues.flush (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/backburner.js:426:1)
    at Backburner._end (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/backburner.js:960:1)
    at Backburner._boundAutorunEnd (/tmp/broccoli-3205602HSpNEDzKCP6E/out-595-broccoli_merge_trees/assets/backburner.js:629:1)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
mydea commented 4 years ago

I don't think IndexedDb is available in Node :/ So I guess this does not work with Fastboot as of now. Not quite sure what we'd need to do to support Node - but I would be happy to accept PRs along this line!

oliverlj commented 4 years ago

I just like to prerender for google with prember some route which don't use indexeddb :)

mydea commented 4 years ago

Yeah, I get that. I think you could make it work by excluding the addon in fastboot, something like this:

 let app = new EmberApp(defaults, {
    addons: {
      blacklist: ['ember-indexeddb'], // make this conditional, if fastboot?
    },
});