Skip to content

S3 storage adapter does not store full URL (anymore) when disablePayloadAccessControl is true #15382

@jhb-dev

Description

@jhb-dev

Describe the Bug

Since PR #15089, which was released in v3.71.0, when using the @payloadcms/storage-s3 adapter with disablePayloadAccessControl: true, the full S3 URL is no longer stored in the database.

Expected behavior (before v3.71.0):
When disablePayloadAccessControl: true is set, the full S3 URL should be stored in the database, e.g.:

https://your-bucket.s3.us-east-1.amazonaws.com/media/image.jpg

Actual behavior (since v3.71.0):
Only the relative Payload API URL is stored in the database, e.g.:

/api/media/file/image.jpg

This is a regression because the purpose of disablePayloadAccessControl: true is to bypass Payload's access control and serve files directly from S3. Storing the relative URL defeats this purpose and requires additional logic to construct the full S3 URL.

Link to the code that reproduces this issue

https://github.com/jhb-dev/payload-s3-url-regression

Reproduction Steps

  1. Clone the reproduction repository and run the development server
  2. Configure your S3 credentials in the .env file
  3. Start the development server with pnpm dev
  4. Create a user account and log in to the admin panel at http://localhost:3000/admin
  5. Navigate to the Media collection and upload an image
  6. Check the database - the url field will contain /api/media/file/[filename] instead of the full S3 URL
  7. The same issue affects the sizes URLs (thumbnail, card, etc.)

Which area(s) are affected?

area: core

Environment Info

Binaries:
  Node: 24.3.0
  npm: 11.4.2
  Yarn: 1.22.22
  pnpm: 10.28.1
Relevant Packages:
  payload: 3.73.0
  next: 15.4.11
  @payloadcms/db-mongodb: 3.73.0
  @payloadcms/graphql: 3.73.0
  @payloadcms/next/utilities: 3.73.0
  @payloadcms/plugin-cloud-storage: 3.73.0
  @payloadcms/richtext-lexical: 3.73.0
  @payloadcms/storage-s3: 3.73.0
  @payloadcms/translations: 3.73.0
  @payloadcms/ui/shared: 3.73.0
  react: 19.2.1
  react-dom: 19.2.1
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.6.0
  Available memory (MB): 24576
  Available CPU cores: 14

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions