Skip to content

payloadcms not working with uuid v7 #11449

@kenneth-devedis

Description

@kenneth-devedis

Describe the Bug

I cannot login, when I create a user that has a uuid v7 as id.

I did some digging:
The issue is the validate function of the uuid package.
The relevant usage site would be: https://github.com/payloadcms/payload/blob/main/packages/drizzle/src/queries/sanitizeQueryValue.ts#L108
The used version uses this regex: https://github.com/uuidjs/uuid/blob/v9.0.0/src/regex.js

This only accepts [1-5] as version nibble and thus does not recognize a uuid v7 as uuid.

This is fixed in newer versions of the uuid package. A simple version bump should fix the issue.

As workaround for now I can overwrite the dependency in my package.json

Link to the code that reproduces this issue

https://github.com/kenneth-devedis/payload-website-postgres-example

Reproduction Steps

  • install dependencies
  • start database with docker compose up
  • copy .env.example to .env
  • run pnpm run dev
  • visit http://localhost:3000/admin
  • create login
  • try to login again and again
  • question your sanity

Which area(s) are affected? (Select all that apply)

db-postgres

Environment Info

Binaries:
  Node: 22.12.0
  npm: 10.9.0
  Yarn: N/A
  pnpm: 10.3.0
Relevant Packages:
  payload: 3.24.0
  next: 15.1.7
  @payloadcms/db-postgres: 3.24.0
  @payloadcms/email-nodemailer: 3.24.0
  @payloadcms/graphql: 3.24.0
  @payloadcms/live-preview: 3.24.0
  @payloadcms/live-preview-react: 3.24.0
  @payloadcms/next/utilities: 3.24.0
  @payloadcms/payload-cloud: 3.24.0
  @payloadcms/plugin-cloud-storage: 3.24.0
  @payloadcms/plugin-form-builder: 3.24.0
  @payloadcms/plugin-nested-docs: 3.24.0
  @payloadcms/plugin-redirects: 3.24.0
  @payloadcms/plugin-search: 3.24.0
  @payloadcms/plugin-seo: 3.24.0
  @payloadcms/richtext-lexical: 3.24.0
  @payloadcms/storage-vercel-blob: 3.24.0
  @payloadcms/translations: 3.24.0
  @payloadcms/ui/shared: 3.24.0
  react: 19.0.0
  react-dom: 19.0.0

Metadata

Metadata

Assignees

No one assigned

    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