Skip to content

Uncaught (in promise): QuotaExceededError #19101

@noinfo

Description

@noinfo

Before reporting an issue

  • I have searched existing issues
  • I have reproduced the issue with the latest release

Area

adapter/javascript

Describe the bug

If the localStorage is full enough for

localStorage.setItem('kc-test', 'test');

to succeed but storing the actual state will fail it will fail mostly unnoticed.

This can also happen if the localStorage is filled between the time that the check with kc-test occurred and actual cs.add is called.

Version

21

Expected behavior

Setting the item to localStorage should be wrapped in try/catch and QuotaExceeded should be handled - e.g. by switching to CookieStorage or at least communicating the error.

Actual behavior

Keycloak auth becomes unresponsive and error is logged to devtools.

instrument.js:108 Error: Uncaught (in promise): QuotaExceededError: Failed to execute 'setItem' on 'Storage': Setting the value of 'kc-callback-c4f94736-f6ab-4829-8674-2826942a9efc' exceeded the quota.

Error: Failed to execute 'setItem' on 'Storage': Setting the value of 'kc-callback-c4f94736-f6ab-4829-8674-2826942a9efc' exceeded the quota.
    at LocalStorage.cs.add (keycloak.mjs:1661:26)
    at Keycloak.kc.createLoginUrl (keycloak.mjs:471:25)
    at Object.login (keycloak.mjs:1344:48)
    at Keycloak.kc.login (keycloak.mjs:332:24)
    at doLogin (keycloak.mjs:189:20)
    at onLoad (keycloak.mjs:239:21)
    at processInit (keycloak.mjs:291:21)
    at _ZoneDelegate.invoke (zone.js:375:26)
    at Object.onInvoke (core.mjs:24178:33)
    at _ZoneDelegate.invoke (zone.js:374:52)
    at Zone.run (zone.js:134:43)
    at zone.js:1278:36
    at _ZoneDelegate.invokeTask (zone.js:409:31)
    at core.mjs:23864:55
    at AsyncStackTaggingZoneSpec.onInvokeTask (core.mjs:23864:36)
    at _ZoneDelegate.invokeTask (zone.js:408:60)
    at Object.onInvokeTask (core.mjs:24165:33)
    at _ZoneDelegate.invokeTask (zone.js:408:60)
    at Zone.runTask (zone.js:178:47)
    at drainMicroTaskQueue (zone.js:588:35)
    at resolvePromise (zone.js:1214:31)
    at resolvePromise (zone.js:1168:17)
    at zone.js:1281:17
    at _ZoneDelegate.invokeTask (zone.js:409:31)
    at core.mjs:23864:55
    at AsyncStackTaggingZoneSpec.onInvokeTask (core.mjs:23864:36)
    at _ZoneDelegate.invokeTask (zone.js:408:60)
    at Object.onInvokeTask (core.mjs:24165:33)
    at _ZoneDelegate.invokeTask (zone.js:408:60)
    at Zone.runTask (zone.js:178:47)
    at drainMicroTaskQueue (zone.js:588:35)

How to Reproduce?

  1. Either fill up your localStorage so that the test can still be stored but nothing else or fill up your localStorage (e.g. using browser dev tools) after keycloak has initialized with localStorage set as this.cs.
  2. Try to authenticate.

Anything else?

No response

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions