Skip to content

Setting basePath breaks Media collection image previews #15111

@felixkpunkt

Description

@felixkpunkt

Describe the Bug

Setting a basePath in the next.config.mjs seems to break the image previews in the admin area. The request URL to fetch the image does not contain the basePath.

Image Image

Link to the code that reproduces this issue

https://github.com/felixkpunkt/payload-basePath-issue

Reproduction Steps

  1. npx create-payload-app
  2. set a custom basePath in the next.config.mjs
  3. create a Media & save

Which area(s) are affected?

Not sure, area: core

Environment Info

Binaries:
  Node: 24.12.0
  npm: 11.6.2
  Yarn: N/A
  pnpm: 10.27.0
Relevant Packages:
  payload: 3.70.0
  next: 15.4.10
  @payloadcms/db-sqlite: 3.70.0
  @payloadcms/drizzle: 3.70.0
  @payloadcms/graphql: 3.70.0
  @payloadcms/next/utilities: 3.70.0
  @payloadcms/richtext-lexical: 3.70.0
  @payloadcms/translations: 3.70.0
  @payloadcms/ui/shared: 3.70.0
  react: 19.2.1
  react-dom: 19.2.1
Operating System:
  Platform: linux
  Arch: x64
  Version: #1 SMP PREEMPT_DYNAMIC Thu Jun  5 18:30:46 UTC 2025
  Available memory (MB): 15953
  Available CPU cores: 16

Metadata

Metadata

Assignees

No one assigned

    Labels

    status: needs-triagePossible bug which hasn't been reproduced yet

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions