analytics-next icon indicating copy to clipboard operation
analytics-next copied to clipboard

priority-queue throws "Failed to execute setItem on Storage"

Open prescottprue opened this issue 3 months ago • 0 comments

We are seeing the following error:

QuotaExceededError: Failed to execute 'setItem' on 'Storage': Setting the value of 'persisted-queue:v1:BGnTdxPHAw7r7tNB03yaxqgAs6xYlNtD:dest-Segment.io:items' exceeded the quota.

It appears that persisted queue uses window.localStorage which does not have protection against failure to setItem such as in the case of QuotaExceededError. We specifically were setting this on the call to setItem in persistItems function

It seems that there is a localStorage utility which has this protection but that utility is not used in this case, instead window.localStorage is used directly

I'm open to making a PR to use the utility that exists to address this, but wasn't sure if this was an intentional choice for some reason? And instead do a try/catch in persist items?

prescottprue avatar Aug 20 '25 23:08 prescottprue