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

InvalidStateError on Firefox #312

Open
julienfouilhe opened this Issue Sep 13, 2016 · 9 comments

Comments

Projects
None yet
6 participants
@julienfouilhe

julienfouilhe commented Sep 13, 2016

Hi,

For some time now, I've seen a recurring error: InvalidStateError

InvalidStateError occurred when opening database database_name. A mutation operation was attempted on a database that did not allow mutations.

This happens with this simple code:

  var db = new Dexie('database_name');
  db.version(2).stores({ actions: '++_id, *scoreId, &id' });

  db.open().then(function() {
    // not entering there
  }.bind(this)).catch(function(err) {
    // catching invalid state error
  }.bind(this));

It only happens on Firefox (v39 to v48), rarely though. I was never able to reproduce it, I've only seen this happen to my users, via bug reporting.

I've seen this link that seems to be related but I can't figure out what I'm doing wrong: http://stackoverflow.com/questions/24295588/indexeddb-error-in-firefox-when-calling-createobjectstore

@julienfouilhe julienfouilhe changed the title from InvalidStateError to InvalidStateError on Safari Sep 13, 2016

@julienfouilhe julienfouilhe changed the title from InvalidStateError on Safari to InvalidStateError on Firefox Sep 13, 2016

@julienfouilhe

This comment has been minimized.

Show comment
Hide comment
@julienfouilhe

julienfouilhe Sep 13, 2016

Seems to be produced when using private navigation. I guess this is related to the way Firefox handles storing data in private mode. Safari throws a MissingAPIError too.

I think that the fact that IndexedDB does not work in private mode for those browsers should be put forward in the documentation. It would save time to a lot of developers. Not Dexie's fault but nice to mention anyway! ;)

julienfouilhe commented Sep 13, 2016

Seems to be produced when using private navigation. I guess this is related to the way Firefox handles storing data in private mode. Safari throws a MissingAPIError too.

I think that the fact that IndexedDB does not work in private mode for those browsers should be put forward in the documentation. It would save time to a lot of developers. Not Dexie's fault but nice to mention anyway! ;)

@dfahlander

This comment has been minimized.

Show comment
Hide comment
@dfahlander

dfahlander Sep 13, 2016

Owner

Ok, thanks for sharing this. I don't get why cookies are allowed but not indexedDB. Probably due to the lack of a RAM memory based indexeddb implementation.

I could write some doc about this issue and how to give users a better experience than just obscure error messages. It might be useful to update dexie to give a common error for errors due to private browsing. I'll see what I could do about it.

Owner

dfahlander commented Sep 13, 2016

Ok, thanks for sharing this. I don't get why cookies are allowed but not indexedDB. Probably due to the lack of a RAM memory based indexeddb implementation.

I could write some doc about this issue and how to give users a better experience than just obscure error messages. It might be useful to update dexie to give a common error for errors due to private browsing. I'll see what I could do about it.

@dev0x10

This comment has been minimized.

Show comment
Hide comment
@dev0x10

dev0x10 Oct 2, 2016

When trying to set in private browser there will be an error thrown

DexieError {_e: Error, name: "OpenFailedError", message: "QuotaExceededError The quota has been exceeded.", inner: DexieError, _stack: "OpenFailedError: QuotaExceededError The quota has …/prototype.testing.com/app.bundle.js:53871:50", …}

That quota ExceededError is same error thrown when trying to use localStorage on Safari private browsing
This means Dexie doesn't support private browsing, right?

dev0x10 commented Oct 2, 2016

When trying to set in private browser there will be an error thrown

DexieError {_e: Error, name: "OpenFailedError", message: "QuotaExceededError The quota has been exceeded.", inner: DexieError, _stack: "OpenFailedError: QuotaExceededError The quota has …/prototype.testing.com/app.bundle.js:53871:50", …}

That quota ExceededError is same error thrown when trying to use localStorage on Safari private browsing
This means Dexie doesn't support private browsing, right?

@julienfouilhe

This comment has been minimized.

Show comment
Hide comment
@julienfouilhe

julienfouilhe Oct 2, 2016

@dev0x10 I've had this one too and it seems to mean that the user's disk is full and therefore browser denies opening a database

julienfouilhe commented Oct 2, 2016

@dev0x10 I've had this one too and it seems to mean that the user's disk is full and therefore browser denies opening a database

@dev0x10

This comment has been minimized.

Show comment
Hide comment
@dev0x10

dev0x10 Oct 2, 2016

@julienfouilhe oh yes user's disk full also can cause that problem. But mostly it is happen because of private browsing mode, especially in Safari
I'd like to know if there is a workaround for using Dexie in private browsing mode

dev0x10 commented Oct 2, 2016

@julienfouilhe oh yes user's disk full also can cause that problem. But mostly it is happen because of private browsing mode, especially in Safari
I'd like to know if there is a workaround for using Dexie in private browsing mode

@indolering

This comment has been minimized.

Show comment
Hide comment
@indolering

indolering Nov 2, 2016

There really should be a more informative warning for when IndexedDB isn't available....

indolering commented Nov 2, 2016

There really should be a more informative warning for when IndexedDB isn't available....

@DemersM

This comment has been minimized.

Show comment
Hide comment
@DemersM

DemersM Apr 6, 2017

People at Firefox are working (slowly) to fix the issue and to enable IndexedDB in private mode: https://bugzilla.mozilla.org/show_bug.cgi?id=781982

DemersM commented Apr 6, 2017

People at Firefox are working (slowly) to fix the issue and to enable IndexedDB in private mode: https://bugzilla.mozilla.org/show_bug.cgi?id=781982

@NelsonMinar

This comment has been minimized.

Show comment
Hide comment
@NelsonMinar

NelsonMinar Jan 6, 2018

According to MDN docs the only browser that supports IndexedDB in private mode is Chrome.
https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API#Browser_compatibility

NelsonMinar commented Jan 6, 2018

According to MDN docs the only browser that supports IndexedDB in private mode is Chrome.
https://developer.mozilla.org/en-US/docs/Web/API/IndexedDB_API#Browser_compatibility

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment