-
Notifications
You must be signed in to change notification settings - Fork 2
fix: block until provisioned database accepts connections #84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
AmanVarshney01
wants to merge
1
commit into
main
Choose a base branch
from
fix/database-readiness-probe
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
Repository: prisma/create-db
Length of output: 9717
🌐 Web query:
@prisma/ppg AbortController timeout collect prismaPostgres sql timeout abort signal💡 Result:
As of July 2026, the
@prisma/ppg(Prisma Postgres serverless driver) library does not natively supportAbortControllerorAbortSignalfor canceling database queries [1][2][3]. WhileAbortControlleris a widely adopted standard in Node.js and web environments for cancelling asynchronous operations, it is not currently integrated into the@prisma/ppgquery execution flow [4][5][6]. Consequently, there is no mechanism to pass anAbortSignalto the client'ssql,query, orexecmethods to terminate a long-running database request before it finishes [2][3]. Regarding timeouts and query management: - Query Timeouts: Prisma Postgres enforces internal timeouts depending on the connection type [7][8]. For pooled connections (common for application traffic), there is a 10-minute query timeout [8]. When using direct connections, specific, shorter timeouts apply (e.g., up to 10 seconds for standard queries, 15 seconds for interactive transactions) [7]. - Client Limitations: The@prisma/ppgclient is designed for HTTP and WebSocket-based communication [1][8]. Because it manages its own transport layer, users cannot manually implementAbortControllerat the driver level to "force" the cancellation of a network request sent through this client [2][3]. If your use case requires preventing long-running operations from consuming resources, you must rely on server-side configuration and the inherent timeout limits enforced by the Prisma Postgres infrastructure rather than client-side signals [7][8]. [1][4][2][3][7][8]Citations:
AbortController/AbortSignalprisma#15594🌐 Web query:
@prisma/ppg defaultClientConfig timeout query cancellation direct connection options💡 Result:
The
@prisma/ppglibrary (also known as the Prisma Postgres serverless driver) is designed for serverless and edge environments, communicating via HTTP and WebSockets rather than the standard PostgreSQL TCP wire protocol [1][2][3]. Regarding your specific configuration and features: 1. defaultClientConfig: This function is used to initialize the client configuration, typically with the Prisma Postgres Direct TCP URL [1][4][5]. It automatically includes essential type parsers and serializers (for types like Date, JSON, and BigInt) [4][5]. Usage typically looks like this: const ppg = prismaPostgres(defaultClientConfig(process.env.PRISMA_DIRECT_TCP_URL!)); 2. Timeout and Query Cancellation: The@prisma/ppgdriver itself does not expose explicit configuration options for query-level timeouts or cancellation via a standard API (such as an AbortController signal) in the same manner as some other fetch-based libraries [1][4][5]. Prisma ORM generally manages its own timeouts separate from database drivers [6][7]. For long-running queries in Prisma Postgres environments, be aware that pooled connections enforce a 10-minute timeout [2][8]. If your workload requires longer execution times or complex session states, you must use a direct connection, which bypasses the pooler [2][8]. 3. Direct Connection Options: While@prisma/ppgrequires a "Direct TCP Connection" URL, it is important to clarify that this is used for routing and identification [1][2]. The transport remains HTTP/WebSocket [2]. If you are performing operations that require a true TCP-based direct connection—such as migrations, introspection, or specific session-level commands like LISTEN/NOTIFY—you should use the standard Prisma Client with the appropriate driver adapter (e.g.,@prisma/adapter-pg) rather than the@prisma/ppgserverless driver [2][3][8]. In summary,@prisma/ppgis optimized for serverless performance and automatic connection pooling; if you find yourself needing low-level manual timeout controls or native TCP features, you are likely looking for the standard Prisma driver adapter approach instead [2][6][3].Citations:
🏁 Script executed:
Repository: prisma/create-db
Length of output: 643
Treat this as a soft deadline.
@prisma/ppgdoesn’t expose query cancellation, so a stalledcollect()can run past 30s and the fixed 500ms backoff can add extra delay. Cap the sleep to the remaining budget, and if a hard cutoff is required, wrap the probe in an outer timeout and returnfalsewhen it expires.🤖 Prompt for AI Agents