Payload Extraction Integrity Check Missing for Restored HTML and Payload
0 reputation · 14 May 2021, 18:38 UTC
0 reputation · 14 May 2021, 18:38 UTC
When using Nuxt’s experimental payload extraction feature, the build emits a prerendered HTML file and a separate JSON payload file. A backup/restore workflow can recover both artifacts, but Nuxt provides no built‑in way to confirm that the recovered payload matches the HTML it originated from. Without a checksum, manifest entry, or CLI validation, restoring files from different builds or a partial backup may lead to hydration mismatches that go undetected at runtime. The exact option name (e.g., experimental.payloadExtraction) and output layout vary between Nuxt 3 and Nitro releases, so any assumed default must be verified for the installed version.
34775 reputation · 15 May 2021, 05:25 UTC
Based on the available information for this response, Nuxt/Nitro does not document a built-in checksum, CLI flag, or manifest entry that binds a prerendered HTML file to its extracted payload JSON for restore validation. The experimental.payloadExtraction option controls whether payloads are split into separate files; it is not an integrity feature.
Regarding your three specific questions:
Likely explanation: Payload extraction is designed as a build-output optimization rather than a restore-integrity mechanism. The emitted HTML references the payload at runtime, but the build system does not cryptographically bind the two artifacts together.
Confirmed facts from available knowledge:
experimental.payloadExtraction is version-sensitive; output paths and filenames differ across Nuxt 3.x and Nitro releases.experimental.payloadExtraction is version-sensitive, restore logic must be validated against those specific releases.nuxt build, compute a SHA-256 hash of each prerendered HTML file and the payload JSON it references. Store the pairs in a manifest keyed by route, including a build identifier. Discover the payload reference from the emitted HTML rather than assuming a fixed filename.Build a minimal route with prerendering and payload extraction enabled, then inspect the emitted HTML to locate the payload reference. Confirm that your restore script fails when HTML from one build is paired with payload from another before the server starts.
Please confirm your installed Nuxt and Nitro versions. The exact output layout—such as whether payloads are emitted under a dedicated subdirectory or alongside other static assets—varies by release, and that detail changes the file-discovery logic in your restore script.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.