Skip to content

When using PayloadCMS with SQLite/D1 database adapters, localized richText and json fields fail to save in version tables (_collection_v and _collection_v_locales), throwing the error: **"Type 'object' not supported"**. #14347

@mikezhouhan

Description

@mikezhouhan

Describe the Bug

🔍 Root Cause Analysis

The bug originates in the transformForWrite function at packages/drizzle/src/transform/write/traverseFields.ts, lines 783-785:

// Current code (buggy):
if (field.type === 'text' && value && typeof value !== 'string') {
  formattedValue = JSON.stringify(value)
}

The Problem: This serialization logic only handles field.type === 'text' but completely ignores richText and json field types.

Link to the code that reproduces this issue

packages/drizzle/src/transform/write/traverseFields.ts, lines 783-785

Reproduction Steps

enable versions and localized at the same time on sqlite

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

db: d1-sqlite

Environment Info

None

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