问题反馈
商城线上BUG应急响应群于2025.12.21 10:31反馈客户无法支付订单,购物车页面提示 The quota has been exceeded
问题复现
暂时无法复现
问题排查
1、后端代码和日志没找到
2、前端代码和日志没找到
3、eta接口不会有这种错误
4、查看前端代码确定弹窗逻辑,只有在库存检测和catch中有弹窗
5、后台查看库存检测接口逻辑
6、前端看catch逻辑,谷歌搜索The quota has been exceeded,发现跟localStorage.setItem有关,代码里确实也存在localStorage.setItem的逻辑
https://www.cnblogs.com/gwf93/p/10169373.html
https://community.atlassian.com/forums/Jira-questions/Exception-QuotaExceededError-The-quota-has-been-exceeded/qaq-p/1214711
7、根据经验感觉 localStorage.setItem报错
8、前端验证localStorage.setItem错误验证,gpt生成验证代码
function testLocalStorageOverflow() {
let str = "中"; // 中文,稳定占空间
try {
while (true) {
str += str; // 指数级增长
localStorage.setItem("nearbycorp", str);
console.log("当前长度:", str.length);
}
} catch (e) {
console.error("触发异常!");
console.error("字符长度:", str.length);
console.error(e.name, e.message);
}
}
testLocalStorageOverflow();
9、Chrome 验证 Failed to execute 'setItem' on 'Storage': Setting the value of 'nearbycorp' exceeded the quota.
10、火狐验证 QuotaExceededError The quota has been exceeded.
11、Safari验证 QuotaExceededError The quota has been exceeded.
12、代码验证模拟出用户弹窗错误
尝试分析Common Causes 常见原因
- LocalStorage Full: Browsers typically limit localStorage to approximately 5MB to 10MB per domain. Attempting to store more than this will trigger the error.
LocalStorage 满: 浏览器通常将 localStorage 限制在每个域大约 5MB 到 10MB 之间。尝试存储超过这个数值会触发错误。 - Exceeded Disk Quota: The error can occur if your computer or device has low disk space, preventing the browser from writing new data.
超额磁盘配额: 如果电脑或设备磁盘空间不足 ,导致浏览器无法写入新数据,就可能发生错误。 - Private/Incognito Browsing: Older versions of Safari (pre-iOS 11) threw this error because they allocated zero quota to storage in Private Browsing mode. Most modern browsers now use a temporary, volatile "bucket" for private data.
私人/隐身浏览: 旧版 Safari(iOS 11 之前)出现了这个错误,因为他们在私密浏览模式下为存储分配了零配额。大多数现代浏览器现在使用一个临时且易失性的“桶”来存储私人数据。 - https://blog.csdn.net/u010377383/article/details/108283638
问题解决--How to Fix (For Users)如何修复(用户用)
- Clear Browser Data: Delete the cache and local storage for the specific site. In Chrome, you can do this via Settings > Privacy and security > Site settings > View permissions and data stored across sites.
清除浏览器数据: 删除该网站的缓存和本地存储。在 Chrome 中,你可以通过设置 > 隐私和安全 > 网站设置 > 查看权限和存储的数据来实现。 - Free Up Disk Space: Delete unnecessary files from your hard drive to ensure the browser has enough "breathing room" to manage its temporary storage.
释放磁盘空间: 删除硬盘上的不需要文件,确保浏览器有足够的“空间”来管理临时存储。 - 旧版 Safari(iOS 11 之前)不要用无痕模式 使用正常模式浏览
总结
localStorage.setItem 报错,The quota has been exceeded.代码catch 到错误,弹窗显示
需要进一步确定用户的浏览器和ios版本才能明确是LocalStorage Full/超额磁盘配额/Safari版本的问题
参考链接
https://www.cnblogs.com/gwf93/p/10169373.html
https://community.atlassian.com/forums/Jira-questions/Exception-QuotaExceededError-The-quota-has-been-exceeded/qaq-p/1214711
https://blog.csdn.net/u010377383/article/details/108283638