Skip to content

basePath not working for forgot password form #16082

@xavierchow

Description

@xavierchow

Describe the Bug

When the basePath (in my case it's /cms) is set, the forgot password form action url is still the default one /api/users/forgot-password without the prefix, which cause a 500 error when submitting the form.

⨯ Error: Failed to find Server Action. This request might be from an older or newer deployment.
Read more: https://nextjs.org/docs/messages/failed-to-find-server-action
    at ignore-listed frames
⨯ Error: Failed to find Server Action. This request might be from an older or newer deployment.
Read more: https://nextjs.org/docs/messages/failed-to-find-server-action
    at ignore-listed frames
 POST /api/users/forgot-password 500 in 1879ms (next.js: 1807ms, application-code: 72ms)
Image

It's worth mentioning the login form is correct with basePath included.

Image

Link to the code that reproduces this issue

https://github.com/xavierchow/payload-forgot-pwd-form-issue

Reproduction Steps

  1. npx create-payload-app
  2. add basePath /cms to the next.config.ts
  3. pnpm dev
  4. create the first user and logout
  5. go to the login page and click the forgot password link
  6. submit any email in the forgot password form
  7. server returns 500 error

Which area(s) are affected?

Not sure

Environment Info

Binaries:
  Node: 24.11.1
  npm: 11.6.2
  Yarn: 1.22.22
  pnpm: 10.27.0
Relevant Packages:
  payload: 3.80.0
  next: 16.2.1
  @payloadcms/db-sqlite: 3.80.0
  @payloadcms/drizzle: 3.80.0
  @payloadcms/graphql: 3.80.0
  @payloadcms/next/utilities: 3.80.0
  @payloadcms/richtext-lexical: 3.80.0
  @payloadcms/translations: 3.80.0
  @payloadcms/ui/shared: 3.80.0
  react: 19.2.4
  react-dom: 19.2.4
Operating System:
  Platform: darwin
  Arch: arm64
  Version: Darwin Kernel Version 24.3.0: Thu Jan  2 20:24:24 PST 2025; root:xnu-11215.81.4~3/RELEASE_ARM64_T6030
  Available memory (MB): 18432
  Available CPU cores: 11

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions