Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
When postObjectVersionWithLabel reaches the `return 500, 'Version was
not created'` branch, no console.error is emitted, so the failure
arrives in Cloudflare Logs with empty Logs[] / Exceptions[]. Forensics
on a recent cluster of these failures on legacy HTML imports traced
them to source objects missing ContentType metadata:
shouldCreateVersion(undefined) is false, putObjectWithVersion returns
{ status: 200, versionCreated: false }, and the silent 500 falls out.
Adds a single, scoped diagnostic log capturing contentType, hadLabel,
and the source-object status so the next log review can confirm the
contentType-missing theory without further code archaeology.
Test asserts the silent-500 path now emits a structured log row with
the expected fields when the source contentType is undefined.
Co-Authored-By: Paperclip <noreply@paperclip.ing>
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
console.errorinpostObjectVersionWithLabelbefore the existing silentreturn { status: 500, error: "Version was not created" }branch, capturing{ contentType, hadLabel, currentStatus }so the failure shows up in Cloudflare Logs instead of arriving empty.Why
We saw a cluster of
POST /versionsourcereturning 500 with emptyLogs[], emptyExceptions[], andOutcome == ok, concentrated on legacy-imported HTML pages. After #271 closed the 412-race silent-500, the only remaining path to that branch isputObjectWithVersionreturning{ status: 200, versionCreated: false }, which requiresshouldCreateVersion(contentType)to be false. For these legacy-imported HTML pages the S3 object metadata is missingContentType, socurrent.contentTypeisundefined->createVersion=false-> no version object is written -> silent 500.Without instrumentation, the next log review cannot tell whether the cluster is contentType-missing, label-related, or a regression. This adds the cheapest possible diagnostic so the theory can be confirmed (or refuted) from logs alone -- no code archaeology, no client repro needed.
Approach
postObjectVersionWithLabelemits a structuredconsole.errorwithcontentType,hadLabel,currentStatuswhen the source object has nocontentType. Confirmed it failed onmainbefore the implementation change.status: currentStatusfrom the outergetObjectcall and emit oneconsole.errorinside the!resp.versionCreatedbranch.shouldCreateVersionand/or repairing the missing ContentType metadata. Get diagnostic data to confirm root cause before changing the gate.Test plan
npm run lintclean on touched filesnpm test-- 392 passing including the new regression; 100% line coverage onsrc/storage/version/put.jsFailed to version (no version created)row should appear with the dominant URL set, confirming the contentType-missing theory.Refs