Skip to content

[v4 beta] Storage adapter API regression: signed upload context removed without an equivalent replacement #18763

Description

@damnsamn

The below is AI generated, but there's been a fair bit of revision to edit pare it back a bit.

Summary

The v4 storage adapter API removes capabilities that were available in v3:

  • Carrying adapter-owned, verified data through signed upload receipts.
  • Using that data to implement a storage layout different from Payload’s default.

We cannot find an equivalent extension point that retains Payload’s standard original-file tracking, transformations, history and cleanup behaviour.

We maintain an internal adapter for our preferred storage provider. The concern is the loss of adapter API flexibility, rather than a request for one particular storage layout.

Versions

Package Previous Current
payload 3.90.1 4.0.0-beta.1
@payloadcms/plugin-cloud-storage 3.90.1 4.0.0-beta.1

Background: this started with a recent v3 change

Previously, uploads used a flat storage layout by default.

A recent v3 update introduced per-upload UUID directories alongside signed upload receipts. We noticed this after upgrading, when new files started appearing inside these directories.

The v3 adapter API still gave us the tools to restore our preferred layout while keeping signed upload verification.

The v4 changes remove those tools and introduce stricter path assumptions in the standard upload flow.

What changed in the API

1. Receipts no longer accept adapter-owned context

In v3, createClientUploadReceipt() accepted context. Payload verified the receipt and passed its authenticated context to the storage handler.

An adapter could use this to carry a verified provider object ID or other provider-specific data from upload completion into the document save.

The v3 receipt implementation supported this. The v4 receipt implementation instead accepts a fixed set of storage-identity fields, without adapter-owned context.

2. Core removes supplementary reference fields

The v4 upload-instructions refactor (#17312) replaced clientUploadContext with uploadReference.

With requiresUploadReceipt: true, the subsequent receipt-validation change replaces the submitted reference with:

{
  _objectKey: receipt._objectKey,
  prefix: receipt.filePrefix,
  signedReceipt,
}

Returning additional data from the client upload handler therefore does not provide an alternative:

return {
  ...originalUploadReference,
  providerObjectId,
  signedProviderContext,
}

Neither additional field reaches the server-side storage handler.

We are not asking Payload to trust client-supplied IDs. The adapter must verify them against the original upload authorisation before treating them as trusted data.

3. The standard receipt flow requires a particular path structure

The upload file-versioning implementation (#18548) added a check that an ordinary new upload’s original storage path ends in:

<filePrefix>/<objectKey>/<name-original.ext>

A path without the _objectKey directory is rejected before the storage handler runs.

The same PR also added UUID object-key generation for managed server-side uploads.

Example impact: flat storage

Our adapter previously used:

uploads/images/example.jpg

The standard v4 flow requires a structure such as:

uploads/images/<objectKey>/example-original.jpg

The extra directory is the concern here, not the -original suffix or UUID format.

Flat storage is one example of the flexibility lost. The broader issue is that adapters can no longer use signed provider context to implement their own verification and storage decisions through the standard flow.

Why opting out is not equivalent

Setting requiresUploadReceipt: false preserves supplementary reference fields and avoids the directory check.

However, in equivalent no-transform tests, Payload stopped populating original. This does not preserve the same automatic original-file tracking and cleanup behaviour.

Using private _payload… request-context fields to restore that behaviour would also create an unsupported dependency on core internals.

Expected behaviour

The adapter API should provide a supported way to:

  • Carry authenticated, adapter-owned upload context.
  • Resolve the provider object and its physical storage path.
  • Retain core receipt checks, original-file tracking, transformations, history and rollback support.

Restoring signed receipt context—or providing an equivalent verification/finalisation hook—would address the first part.

Adapters should also be able to choose their physical storage layout without opting out of core file-management support.

We understand the need for distinct upload identities and safe handling of retained files. The regression is the loss of extension points that previously let adapters meet those requirements without adopting Payload’s default directory structure.

Activity

  1. self-assigned this
    on Oct 16, 2026
  2. nathanlentz commented on Oct 16, 2026

    @nathanlentz
    Collaborator

    Hi @damnsamn, thank you for the feedback here. I'd agree there is a gap and I want to work towards closing it.

    I'm going to come up with a few ideas that should help you out. If I dump them here can you let me know if they'll work for you?

  3. damnsamn commented on Oct 17, 2026

    @damnsamn
    ContributorAuthor

    Hey @nathanlentz, yeah totally mate

  4. nathanlentz commented on Oct 22, 2026

    @nathanlentz
    Collaborator

    @damnsamn Alright! Sorry, I've been thinking about this a lot. I think I have a plan for all of your concerns but I am still working on how to maintain reliable file versioning if an adapter chooses to use flat storage since the current design was written around having unique storage paths per file.

    My current plan:

    • Allow adapters to put adapterData into the upload receipt. It'll be signed by Payload and sent back to your adapter later after upload.
    • Extra fields the browser adds to uploadReference (like your providerObjectId example) reach your adapter in something like uploadReference.clientData. They're unverified, so check them before use.
    • Remove @internal from requiresUploadReceipt and receipt signing to make it public
    • Allow adapters to supply their own resolveStorageKey function which will be used everywhere core builds a key so you can decide where objects live.

    Again, there is inherent complexity with a flat storage layout when every version of a document needs to reliably point at its own physical file. Still thinking through how Payload core can support this.

  5. damnsamn commented on Oct 23, 2026

    @damnsamn
    ContributorAuthor

    Appreciate the thought and effort @nathanlentz. This looks like a good direction to me

    I think when it comes to versioning and transformations - mandating a unique storage path does make more sense. I can imagine the complications that would come with managing and mitigating filename clashes or whatever else in a flat structure. Overall I think if accommodating unknown folder structures is going to overcomplicate the solution or the API - I don't mind accepting that a nested folder structure on the storage end is a requirement for payload uploads to function properly.

    Even conceding the folder structure, I do still think that your adapterData/clientData separation does resolve a regression in the API by allowing us to identify and verify the provider object as we were before the upload versioning changes.

  6. added 2 commits that reference this issue on Oct 26, 2026
    3355177
    cdb8ec4
  7. nathanlentz commented on Oct 26, 2026

    @nathanlentz
    Collaborator

    @damnsamn I've merged two PRs for you. The changes will be in the next beta for you to check out.

  8. damnsamn commented on Oct 27, 2026

    @damnsamn
    ContributorAuthor

    Beautiful mate thanks!

  9. github-actions commented on Oct 27, 2026

    @github-actions
    Contributor

    🚀 This is included in version v4.0.0-beta.5

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions