Skip to content

Using read replicas: Error: Cannot use 'in' operator to search for '_rels' in undefined #13011

@sam-gab

Description

@sam-gab

Describe the Bug

I get this error when using read replicas. Cannot use 'in' operator to search for '_rels' in undefined.
The error shows up when I try to log in, and occasionally when for scripts (used outside nextjs).
It only happens when I use read replica.

I found this code to be the most likely cause of the error.
It turns out, in some cases data is undefined, but the type hinting does not account for that.
For example: in payload/packages/drizzle/src/upsertRow/index.ts

Link to the code that reproduces this issue

https://github.com/sam-gab/payload/tree/main

Reproduction Steps

  • Add a read replica to your database config
  • Try to login to payload or perform some high-volume (10-20 req/sec) ingestion task.

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

drizzle

Environment Info

Relevant Packages:
  payload: 3.44.0
  next: 15.2.4
  @payloadcms/db-postgres: 3.44.0
  @payloadcms/email-nodemailer: 3.44.0
  @payloadcms/email-resend: 3.44.0
  @payloadcms/graphql: 3.44.0
  @payloadcms/live-preview: 3.44.0
  @payloadcms/live-preview-react: 3.44.0
  @payloadcms/next/utilities: 3.44.0
  @payloadcms/plugin-cloud-storage: 3.44.0
  @payloadcms/richtext-lexical: 3.44.0
  @payloadcms/storage-s3: 3.44.0
  @payloadcms/translations: 3.44.0
  @payloadcms/ui/shared: 3.44.0
  react: 19.0.0
  react-dom: 19.0.0

Metadata

Metadata

Assignees

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