dexie / Dexie.js

A Minimalistic Wrapper for IndexedDB
https://dexie.org
Apache License 2.0
11.69k stars 641 forks source link

How to set Dexie.debug to true? #1806

Open lucasrodrigues10 opened 1 year ago

lucasrodrigues10 commented 1 year ago

I'm using Dexie "3.2.1" and can't find a way to set Dexie.debug to true.

This is the docs which I used as reference. https://dexie.org/docs/Dexie/Dexie.debug

Can you help me?

dfahlander commented 1 year ago

Typings are missing for Dexie.debug but it will respect it in regards of console logging. dexie-cloud-addon does not yet respect this value but a new version coming out soon will fix this. See #1801 .

kheos31 commented 10 months ago

Hello @dfahlander !

I just saw this issue after I checked the typing and test on my own your enunciated solution.. But it doesn't work currently.. Or at least, it does not seem to have the behavior announced into the doc.

image

For example, this code with the valorization of debug at these 2 places, using just one valorization or the other, or without valorization of debug property, give me this stack :

An error was thrown in afterAll
Unhandled promise rejection: DataError: Failed to execute 'get' on 'IDBObjectStore': No key or key range specified.
 DataError: Failed to execute 'get' on 'IDBObjectStore': No key or key range specified.
error properties: Object({ _e: Error, inner: DataError: Failed to execute 'get' on 'IDBObjectStore': No key or key range specified., _promise: [object Dexie.Promise] })
Error: Failed to execute 'get' on 'IDBObjectStore': No key or key range specified.
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:3153:39)
    at executePromiseTask (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:797:9)
    at new DexiePromise (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:616:5)
    at Object.apply (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:3150:24)
    at Object.get (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:4464:46)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1313:30)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1294:20)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1237:24)
    at usePSD (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1143:16)
    at newScope (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1047:14)
From previous: 
    at Object.apply (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:3150:24)
    at Object.get (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:4464:46)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1313:30)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1294:20)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1237:24)
    at usePSD (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1143:16)
    at newScope (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1047:14)
    at http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1235:20
Unhandled promise rejection: DataError: Failed to execute 'get' on 'IDBObjectStore': No key or key range specified.
 DataError: Failed to execute 'get' on 'IDBObjectStore': No key or key range specified.
error properties: Object({ _e: Error, inner: DataError: Failed to execute 'get' on 'IDBObjectStore': No key or key range specified., _promise: [object Dexie.Promise] })
Error: Failed to execute 'get' on 'IDBObjectStore': No key or key range specified.
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:3153:39)
    at executePromiseTask (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:797:9)
    at new DexiePromise (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:616:5)
    at Object.apply (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:3150:24)
    at Object.get (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:4464:46)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1313:30)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1294:20)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1237:24)
    at usePSD (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1143:16)
    at newScope (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1047:14)
From previous: 
    at Object.apply (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:3150:24)
    at Object.get (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:4464:46)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1313:30)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1294:20)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1237:24)
    at usePSD (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1143:16)
    at newScope (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1047:14)
    at http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1235:20
Unhandled promise rejection: DataError: Failed to execute 'get' on 'IDBObjectStore': No key or key range specified.
 DataError: Failed to execute 'get' on 'IDBObjectStore': No key or key range specified.
error properties: Object({ _e: Error, inner: DataError: Failed to execute 'get' on 'IDBObjectStore': No key or key range specified., _promise: [object Dexie.Promise] })
Error: Failed to execute 'get' on 'IDBObjectStore': No key or key range specified.
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:3153:39)
    at executePromiseTask (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:797:9)
    at new DexiePromise (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:616:5)
    at Object.apply (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:3150:24)
    at Object.get (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:4464:46)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1313:30)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1294:20)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1237:24)
    at usePSD (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1143:16)
    at newScope (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1047:14)
From previous: 
    at Object.apply (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:3150:24)
    at Object.get (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:4464:46)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1313:30)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1294:20)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1237:24)
    at usePSD (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1143:16)
    at newScope (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1047:14)
    at http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1235:20
Unhandled promise rejection: DataError: Failed to execute 'get' on 'IDBObjectStore': No key or key range specified.
 DataError: Failed to execute 'get' on 'IDBObjectStore': No key or key range specified.
error properties: Object({ _e: Error, inner: DataError: Failed to execute 'get' on 'IDBObjectStore': No key or key range specified., _promise: [object Dexie.Promise] })
Error: Failed to execute 'get' on 'IDBObjectStore': No key or key range specified.
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:3153:39)
    at executePromiseTask (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:797:9)
    at new DexiePromise (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:616:5)
    at Object.apply (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:3150:24)
    at Object.get (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:4464:46)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1313:30)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1294:20)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1237:24)
    at usePSD (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1143:16)
    at newScope (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1047:14)
From previous: 
    at Object.apply (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:3150:24)
    at Object.get (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:4464:46)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1313:30)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1294:20)
    at fn (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1237:24)
    at usePSD (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1143:16)
    at newScope (http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1047:14)
    at http://localhost:9876/_karma_webpack_/webpack:/node_modules/dexie/dist/modern/dexie.mjs:1235:20

No info for the origin of this error in my own code. Is it normal? Does I valorized the property badly?

NB: I found finally the problem after a little day lost on my own bad code, but I would prefer an info about the source caller if this kind of error will be produced..

Thanks in advance.

dfahlander commented 10 months ago

Thanks! This kind of error should be validated earlier in Table.get() to prohibit this kind of native error happening deep within dexie. The async call stack doesn't reveal much. Would also want to look into how Dexie could use Chrome's new async stack tagging Api do improve the call stack.

kheos31 commented 10 months ago

Thanks for response, sounds great for the future so! :D Thanks for this great lib and impatient to try Dexie 4 and discover all new features!