Skip to content

Fluent API returns incorrect object structure with read replica #12

@snake575

Description

@snake575

When using Prisma's Fluent API with a read replica, the returned object does not adhere to the expected structure.

Repro: read-replicas-demo

Current Behavior:

Using the primary database, the following code:

await prisma.$primary().post.findFirst().author()

returns:

{ id: 1, email: '[email protected]', name: null }

However, when using a read replica, this code:

await prisma.post.findFirst().author() 

returns a nested object:

{ author: { id: 1, email: '[email protected]', name: null } }

Expected Behavior

Using a read replica should also return:

{ id: 1, email: '[email protected]', name: null }

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions