From 0059aae8cc032dafa61e2292eabe3834baf0b605 Mon Sep 17 00:00:00 2001 From: pastdue <30942300+past-due@users.noreply.github.com> Date: Thu, 22 Feb 2024 17:32:22 -0500 Subject: [PATCH] file_packager.py: Handle failure to get cached package (#21328) In certain scenarios (such as when quota is exceeded), it's possible for a metadata entry to exist, but the package data to be missing - and `event.target.result` will be undefined. Check for and properly handle this by calling `errback`, so that the `preloadFallback` gets triggered. --- tools/file_packager.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tools/file_packager.py b/tools/file_packager.py index 956ab8a3530cf..9f39984b46fca 100755 --- a/tools/file_packager.py +++ b/tools/file_packager.py @@ -914,6 +914,10 @@ def generate_js(data_target, data_files, metadata): for (var chunkId = 0; chunkId < chunkCount; chunkId++) { var getRequest = packages.get(`package/${packageName}/${chunkId}`); getRequest.onsuccess = function(event) { + if (!event.target.result) { + errback(new Error(`CachedPackageNotFound for: ${packageName}`)); + return; + } // If there's only 1 chunk, there's nothing to concatenate it with so we can just return it now if (chunkCount == 1) { callback(event.target.result);