Skip to content

[BUG]: Seed UUIDs not compatible with Zod/v4 #4551

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
okydk opened this issue May 22, 2025 · 0 comments
Open
1 task done

[BUG]: Seed UUIDs not compatible with Zod/v4 #4551

okydk opened this issue May 22, 2025 · 0 comments
Labels
bug Something isn't working

Comments

@okydk
Copy link

okydk commented May 22, 2025

Report hasn't been filed before.

  • I have verified that the bug I'm about to report hasn't been filed before.

What version of drizzle-orm are you using?

0.43.1

What version of drizzle-kit are you using?

0.31.1

Other packages

[email protected], [email protected]

Describe the Bug

The UUIDs created via drizzle-seed isn't compatible with what is validated via drizzle-zod.

Probably due to RFC 4122 spec.

// Drizzle-seed generated
708257e5-e2b4-410c-65ec-c6a81590be17 (Reported as invalid)
    Version digit (13th): The character at the 13th position is '4' (708257e5-e2b4-**4**10c-65ec-c6a81590be17). This is correct for a version 4 UUID.
    Variant digit (17th): The character at the 17th position is '6' (708257e5-e2b4-410c-**6**5ec-c6a81590be17). This is not one of the allowed characters ('8', '9', 'a', or 'b') for an RFC 4122 compliant UUID. This is the most likely reason for the validation failure.

// crypto.randomUUID()
8fec6e81-233e-4a68-8a4d-3aa19dbb3816 (Accepted as valid)
    Version digit (13th): The character at the 13th position is '4' (8fec6e81-233e-**4**a68-8a4d-3aa19dbb3816). This is correct for a version 4 UUID.
    Variant digit (17th): The character at the 17th position is '8' (8fec6e81-233e-4a68-**8**a4d-3aa19dbb3816). This is one of the allowed characters ('8', '9', 'a', or 'b') for an RFC 4122 compliant UUID.

Sample schema:

export const page = pgTable('page', {
  id: uuid().defaultRandom().primaryKey(),
})

This wasn't an issues in the v3 of drizzle-zod.

@okydk okydk added the bug Something isn't working label May 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant