Skip to content

.transaction([]) fails with Request Timeout Error on large dataset #3892

@abathellier

Description

@abathellier

Bug description

I get this error in v2.8.1

_p [Error]: 
Invalid `prisma.injection.upsert()` invocation in
webpack-internal:///./src/pages/api/injection/index.ts:191:79


  Request Timeout Error
    at Jw.request (/Users/user/project/node_modules/@prisma/client/runtime/index.js:210:54)
    at processTicksAndRejections (internal/process/task_queues.js:97:5) {
  code: 'UND_ERR_REQUEST_TIMEOUT',
  meta: undefined
}
{
  "code": "UND_ERR_REQUEST_TIMEOUT"
}

if I use prisma.$transation on a large dataset (25k) and if i use Promise.all on the same dataset it works.

How to reproduce

  const businesses= await prisma.business.findMany({
      where: { businessOptions: { some: { isSelected: true } } },
      // take: 10,
      include: {
        businessOptions: { where: { isSelected: true }, include: { directory: true } },
      },
    });

   const operations = prisma.map(({ ...data }) =>
      prisma.injection.upsert({
        where: { id: data.id },
        create: { ...data, business: { connect: { id: data.id } } },
        update: {
          ...data,
        },
      }),
    );

   await appClient.$transaction(operations);

Expected behavior

Not throwing error when using prisma.$transation on a large dataset

Prisma information

Environment & setup

  • OS: Macos
  • Database: PostgresSQL 12
  • Node.js version: 12
  • Prisma version: 2.8.1

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions