fix: preview deployments broken on v0.29.0 — postgres 100-arg limit#4257
Merged
Siumauricio merged 1 commit intoDokploy:canaryfrom Apr 19, 2026
Merged
Conversation
…postgres 100-arg limit Closes Dokploy#4256
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What's happening
On v0.29.0, preview deployments are completely broken. A PR triggers the preview creation flow, the GitHub comment appears with "Building", but nothing ever actually builds — no container is created, and every action on the preview card (Delete, Rebuild, Logs, Deployments) fails. The server log shows:
Why
The
applicationtable grew to 99 columns in v0.29.0 (adding Swarm config, Railpack, Heroku, multi-provider git fields, etc.). Drizzle's relational query infindPreviewDeploymentByIdhydrates theapplicationrelation by passing every column tojson_build_array(...), plus two extra blobs for the nestedserverandenvironment → projectrelations. That's 99 + 2 = 101 arguments — one over Postgres's hard-compiledFUNC_MAX_ARGS = 100limit (error code54023).Every call to
findPreviewDeploymentByIdcrashes. Since that function is on the hot path for the GitHub webhook and every UI action on a preview card, nothing works.The fix
In
findPreviewDeploymentById, switch theapplicationrelation from selecting all columns + nested joins to an explicitcolumnsselector with only what's actually used:The
serverandenvironment.projectnested relations were never accessed from the return value of this function anywhere in the codebase — callers that need full application data callfindApplicationByIdseparately. The only field actually pulled off the nestedapplicationobject isserverId(in the deployment log path).This brings the
json_build_arrayargument count from 101 down to 2.Affected file
packages/server/src/services/preview-deployment.tsFixes #4256
Greptile Summary
This PR fixes a regression in v0.29.0 where preview deployments were completely broken due to PostgreSQL's 100-argument limit for
json_build_array. Theapplicationtable grew to 99 columns, causing Drizzle's relational query infindPreviewDeploymentByIdto exceed the limit when it also included two nested blob arguments forserverandenvironment → project.The fix replaces the broad
withclause with a narrowcolumnsselector exposing onlyapplicationIdandserverId. All call sites have been verified: the only consumer ofapplication.*from this function's return value is indeployment.ts, which readspreviewDeployment?.application?.serverId— still present after the change. All other callers only use top-levelpreviewDeploymentfields or callfindApplicationByIdseparately for full application data.Confidence Score: 5/5
Safe to merge — minimal, targeted fix with no regressions identified across all call sites.
The change is a one-file, minimal diff that directly addresses a confirmed production crash (PostgreSQL error code 54023). All callers of
findPreviewDeploymentByIdwere checked: no caller accesses the previously includedserverorenvironment.projectnested fields from the return value, and the only field read fromapplication(serverId) is still included in the newcolumnsselector. TypeScript types would surface any missed access at compile time. No P0 or P1 issues found.No files require special attention.
Reviews (1): Last reviewed commit: "fix: limit application columns in findPr..." | Re-trigger Greptile