Skip to content

Remove warn(prisma-client) This is the 10th instance of Prisma Client being started. warning in Edge (and potentially) other envs) #23763

@nikolasburk

Description

@nikolasburk

When running Prisma Client in Cloudflare Workers, it must be instantiated inside the handler:

  • that's where the DB URL env var is available which is needed to instantiate the driver adapter
  • I/O objects can't be shared across Worker instances

This is different compared to the recommendation typically given for using Prisma Client in Serverless environments where it's supported to be instantiated outside the handler.

Instantiating Prisma Client outside the handler enables reuse of the instance across different function invocations. This also helps prevent the warning: warn(prisma-client) This is the 10th instance of Prisma Client being started.

Since in CF workers, instantiating inside the handler is the only option, the warning is unavoidable and should be removed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug/1-unconfirmedBug should have enough information for reproduction, but confirmation has not happened yet.kind/bugA reported bug.tech/typescriptIssue for tech TypeScript.topic: edge

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions