Skip to content

Commit b679bfe

Browse files
logging: log context on session storage write error (QuotaError) (#6636)
adds some context to the storage write errors observed in telemetry data - in order to pinpoint the exact cause. ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6636-logging-log-context-on-session-storage-write-error-QuotaError-2a56d73d365081c28bb0dbfdfef8395a) by [Unito](https://www.unito.io)
1 parent 5497970 commit b679bfe

File tree

1 file changed

+22
-3
lines changed

1 file changed

+22
-3
lines changed

src/platform/workflow/persistence/composables/useWorkflowPersistence.ts

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,28 @@ export function useWorkflowPersistence() {
2020
const persistCurrentWorkflow = () => {
2121
if (!workflowPersistenceEnabled.value) return
2222
const workflow = JSON.stringify(comfyApp.graph.serialize())
23-
localStorage.setItem('workflow', workflow)
24-
if (api.clientId) {
25-
sessionStorage.setItem(`workflow:${api.clientId}`, workflow)
23+
24+
try {
25+
localStorage.setItem('workflow', workflow)
26+
if (api.clientId) {
27+
sessionStorage.setItem(`workflow:${api.clientId}`, workflow)
28+
}
29+
} catch (error) {
30+
// Only log our own keys and aggregate stats
31+
const ourKeys = Object.keys(sessionStorage).filter(
32+
(key) => key.startsWith('workflow:') || key === 'workflow'
33+
)
34+
console.error('QuotaExceededError details:', {
35+
workflowSizeKB: Math.round(workflow.length / 1024),
36+
totalStorageItems: Object.keys(sessionStorage).length,
37+
ourWorkflowKeys: ourKeys.length,
38+
ourWorkflowSizes: ourKeys.map((key) => ({
39+
key,
40+
sizeKB: Math.round(sessionStorage[key].length / 1024)
41+
})),
42+
error: error instanceof Error ? error.message : String(error)
43+
})
44+
throw error
2645
}
2746
}
2847

0 commit comments

Comments
 (0)