Short answer: for tenant-scoped property exports, authorize an immutable image manifest before reading object bytes, keep the bucket private, and use multipart only when a large generated image can be replayed in independent ranges. The upload method matters, but the production boundary is the manifest that proves every object belongs to the requesting tenant.
The page fires because an export candidate references an object outside its tenant scope. On-call sees an export ID, a tenant-safe identifier, and the rejected object version; it does not see a vague “upload failed” message. Stop that export. Don't turn an ownership rejection into a retry storm.
I've been paged for missed jobs and duplicate deliveries. Those incidents train a useful reflex: work backward from the tenant-visible action, not forward from whichever queue happens to look suspicious. For this system, the investigation path is export manifest, image record, generation job, then transfer attempt. Upload latency is supporting evidence. Authorization is the decision.
Failure trace: the tenant-scoped export rejects an object
A private bucket prevents anonymous reads; it does not prove that tenant A may receive an object stored for tenant B. That proof belongs in application data and policy. Each generated property image needs a tenant ID, property ID, immutable object key, object version, expected byte count, checksum evidence, generation job ID, and readiness state. The export worker must select the record by tenant and image identity together, then carry the authorized version into the manifest.
This makes the alert actionable. A responder can distinguish three conditions that otherwise collapse into “missing image”: the image is still transferring, the image is complete but absent from the authorized manifest, or the manifest contains an ownership mismatch. Only the first is an upload-progress problem. The second is a workflow join problem. The third is a security boundary and should fail closed.
No blind retry.
The object key may include a tenant prefix for operations and lifecycle management, but a prefix is not authority. Queue payloads, filenames, and caller-provided paths are inputs. The database lookup and export authorization decision establish ownership. A duplicate generation delivery should converge on the same transfer attempt when it represents the same logical image, while an intentional regeneration should allocate a new immutable version so an export never changes underneath a reader.
The earlier signal should therefore fire at manifest construction. Count rejected candidates by reason, record a structured audit event, and stop before any storage read. Keep tenant and object identifiers in access-controlled logs or traces rather than metric labels; counters can use bounded reasons such as tenant_mismatch, not_ready, and version_mismatch. This moves detection from a tenant-visible archive to the first place the service has enough information to prove the join is wrong.
Upload decision: how should Node.js send large AI-generated files to private object storage?
Choose the least complex transfer that meets the recovery requirement. A single streaming request is the default for an image that can be resent cheaply. Multipart earns its extra state when the generated file is large enough that repeating the whole transfer is operationally painful and the source can replay byte ranges.
Amazon S3 defines multipart upload as three operations: initiate the upload, upload parts, and complete it. Parts can be uploaded independently and retransmitted after a failure. Its documented limits allow up to 10,000 parts, and every part except the last must be at least 5 MiB. Treat those as service-specific limits, not universal object-storage law; verify the contract of the implementation you deploy.
Part size is a recovery boundary. Larger parts create fewer requests and repeat more bytes when one part must be sent again. Smaller parts narrow each retry but increase bookkeeping. I'm not sure there is a useful global default for AI-generated property images because the answer depends on the actual size distribution, source replay behavior, worker memory ceiling, and request limits. Measure those inputs, then keep the threshold and concurrency configurable.
Node.js should apply backpressure from the storage writer to the image source and bound concurrency both per object and per worker process. Persist the multipart upload ID and each accepted part result before acknowledging queue progress. Completion is a separate state transition: an HTTP success for one part cannot make an image eligible for export, because the multipart operation has not yet assembled the object. The export manifest accepts only the immutable version marked ready after completion and verification.
| Transfer shape | Recovery unit | Isolation requirement | Operational fit |
|---|---|---|---|
| Single streaming upload | Entire object | Authorize the reserved key and final version | Smaller images or sources that cannot replay ranges |
| Multipart upload | One replayable part | Bind upload ID, key, and parts to one tenant record | Large images where partial retry offsets added state |
| Managed media pipeline | Provider-defined job | Preserve tenant identity across its job and delivery model | Teams prioritizing transformations over transfer control |
Multipart isn't suitable when the producer cannot reproduce an exact byte range, images are routinely small, or the team cannot own abandoned-upload cleanup and reconciliation. Stick with one streaming upload in those cases. A managed media pipeline can be the better boundary when resizing, format conversion, and delivery policy dominate the problem; direct object storage gives the application finer control over the tenant manifest, with more state for the team to operate.
Security boundary: authorize the export manifest before fetching bytes
Manifest construction is where the property-management scenario becomes concrete. Suppose tenant tenant-17 requests a ZIP export of listing photos. The query must return only records scoped to tenant-17, but the worker still validates every row before it asks storage for bytes. Defense in depth here is cheap compared with explaining a cross-tenant archive.
The gate below is deliberately boring. It does not know how bytes were uploaded, and it does not accept an object-key prefix as proof. It checks the authorized tenant, immutable version, readiness, expected size, and checksum decision that the upload workflow already recorded.
package exportmanifest
import (
"errors"
"fmt"
)
type ImageRecord struct {
TenantID string
ObjectKey string
ObjectVersion string
State string
ExpectedBytes int64
StoredBytes int64
ChecksumOK bool
}
type ManifestItem struct {
ObjectKey string
ObjectVersion string
}
func Authorize(record ImageRecord, requestedTenant string) (ManifestItem, error) {
if requestedTenant == "" || record.TenantID != requestedTenant {
return ManifestItem{}, errors.New("tenant scope mismatch")
}
if record.ObjectKey == "" || record.ObjectVersion == "" {
return ManifestItem{}, errors.New("immutable object identity is missing")
}
if record.State != "ready" {
return ManifestItem{}, fmt.Errorf("image state is %q", record.State)
}
if record.StoredBytes != record.ExpectedBytes || !record.ChecksumOK {
return ManifestItem{}, errors.New("object completeness is unverified")
}
return ManifestItem{
ObjectKey: record.ObjectKey,
ObjectVersion: record.ObjectVersion,
}, nil
}
Keep transfer retry logic elsewhere. Mixing it into the export gate makes an authorization failure look recoverable and invites a dangerous behavior: retrying with a newly resolved record that was never part of the approved manifest. The export worker should consume a frozen list of authorized object versions. If any item fails validation or reading, fail the export and rebuild a fresh manifest through the same tenant-scoped path.
Crash points deserve explicit tests because the queue's delivery contract and the storage operation do not share a transaction. Terminate a worker after a part result is stored, redeliver the same generation message twice, and verify that a replacement resumes the same tenant-bound attempt without creating two ready versions. Then terminate after object completion but before the application marks the image ready; reconciliation should verify the recorded identity and completeness before advancing the existing record. Finally, build a tenant tenant-17 export with one deliberately injected tenant-29 record and prove that the manifest gate rejects it before a storage read.
That last test is the important one.
Verification: move the first signal to the workflow join
The late page tells on-call that an export was blocked. The earlier signal should show why the manifest population is drifting before an export deadline is threatened. Instrument state transitions for generation allocated, transfer active, object ready, manifest accepted, and export complete. Observe completion latency by object-size band, age of the oldest nonterminal transfer, repeated part bytes, manifest rejection reasons, and exports waiting on images.
Use bounded dimensions. Tenant ID, object key, upload ID, and export ID belong in correlated logs and traces where access is controlled; putting them into metric labels creates an unbounded operational surface. An alert can link to the relevant trace using a tenant-safe correlation value without turning the metrics system into an object index.
The runbook starts at the rejected manifest item. Confirm the requested tenant and immutable version, inspect the image record's last state transition, then follow its generation and transfer correlation IDs. If the record is not ready, the transfer owner handles it. If it is ready but missing from the manifest, inspect the tenant-scoped join. If ownership differs, preserve the audit evidence and keep the export closed. These are separate actions, so they need separate reason codes and separate alert routing. Roll out the instrumentation before tightening the page, then watch it through normal generation bursts and scheduled tenant exports. Your mileage may vary, especially when a portfolio imports many property photos at once; the useful threshold is tied to export risk, not a fashionable latency percentile.
False-positive cost: set the threshold by tenant-visible risk
Page when an unresolved state threatens a scheduled export or when the manifest gate observes an ownership mismatch. Queue a ticket or automated cleanup for an old multipart attempt that blocks no export. This split keeps on-call focused while still closing incomplete multipart uploads under the storage service's documented lifecycle.
The catch is sensitivity. A threshold based only on elapsed upload age will page during legitimate large transfers, while a threshold based only on queue depth can miss one stuck high-priority export. Combine lack of state progress with an approaching export deadline, and route ownership rejection separately because its response is to stop and inspect, not to transfer faster.
Too loose, and the tenant discovers the problem. Too tight, and responders learn to distrust the page.
Both are failures.
False positives have a real reliability cost: they interrupt investigation, encourage broad retries, and hide the rare authorization signal among ordinary slow transfers. Start with audit-only measurements, rehearse the three failure points above, and promote a condition to paging only when the runbook names a concrete decision. The correct upload strategy leaves on-call with one tenant-bound record, one immutable object version, and one clear action.
Top comments (0)