diff --git a/src/runtime/internal/cache.ts b/src/runtime/internal/cache.ts index 56b4251d41..72747fe1fe 100644 --- a/src/runtime/internal/cache.ts +++ b/src/runtime/internal/cache.ts @@ -57,7 +57,12 @@ export function defineCachedFunction( .replace(/:\/$/, ":index"); let entry: CacheEntry = - ((await useStorage().getItem(cacheKey)) as unknown) || {}; + ((await useStorage() + .getItem(cacheKey) + .catch((error) => { + console.error(`[nitro] [cache] Cache read error.`, error); + useNitroApp().captureError(error, { event, tags: ["cache"] }); + })) as unknown) || {}; // https://github.com/unjs/nitro/issues/2160 if (typeof entry !== "object") {