fix: avoid postgres 100-argument limit in findRollbackById - #4924
Merged
Conversation
Rolling back any application fails with PostgresError: cannot pass more than 100 arguments to a function (54023) since 0175_fantastic_peter_quill took the application table to 101 columns. findRollbackById hydrated deployment -> application -> environment -> project, so drizzle compiled all 101 application columns plus the nested blob into one json_build_array() call, above the FUNC_MAX_ARGS = 100 limit. At 99 columns it sat exactly on the limit. None of that nested data is read: the routers only use deployment.applicationId, and rollback()/removeRollbackById() read the rollback row itself. Drop the nested relations, the same shape as Dokploy#4257 for findPreviewDeploymentById. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
windinternet
added a commit
to windinternet/dokploy
that referenced
this pull request
Jul 29, 2026
Brings in the upstream/canary HEAD (5df820a) as an ancestor of this branch using -s ours, matching the 2026-07-15 sync policy. The merge content is intentionally empty; this commit only records that every cherry-picked upstream commit has been reviewed and either integrated or explicitly rejected: - 32 security fixes (Dokploy#4855-Dokploy#4875): all integrated - 8 bug fixes (Dokploy#4626, Dokploy#4847, Dokploy#4876, Dokploy#4877, Dokploy#4911, Dokploy#4924, Dokploy#4929, Dokploy#4931): all integrated - 2 AI custom provider (Dokploy#4882): integrated - 1 icon management (Dokploy#4932): integrated with serviceNetworks stripped (Dokploy#3774 not picked) - SOS / Redis-removal / multi-language cleanup: rejected After this commit, GitHub will no longer list these upstream commits as 'ahead/behind' pending sync. Future upstream changes still need to be re-evaluated per docs/design-docs/2026-07-29-upstream-sync-policy.md.
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 is this PR about?
Rolling back any application on
canaryfails with an opaqueHTTP 400 "Error input: Rolling back". The real error is only in the backend log, and it is the query itself, before any rollback logic runs:findRollbackById()hydrateddeployment -> application -> environment -> project, so drizzle compiled every column ofapplicationplus one blob per nested relation into a singlejson_build_array(...)call. Postgres caps that at the hard-compiledFUNC_MAX_ARGS = 100.At 99 columns the call sat at exactly 99 + 1 = 100 - right on the limit.
0175_fantastic_peter_quill.sqladdednetworkIdsanddetachDokployNetwork, takingapplicationto 101 columns, so every rollback now fails.None of that nested data is actually read: the rollback router only uses
deployment.applicationId, androllback()/removeRollbackById()read the rollback row itself (deploymentId,image,fullContext) and re-fetch the application throughfindApplicationById(). Dropping the nested relations is enough, andtsc --noEmitconfirms nothing else consumed them.This is the same failure and the same fix shape as #4256 / #4257, which narrowed
findPreviewDeploymentById. After this change,findRollbackByIdis no longer the odd one out:findDeploymentById,centralizedDeploymentsWithandfindPreviewDeploymentByIdall narrow their nestedapplicationselection already.The pressure was flagged in advance in #4240:
How this was verified
Local Dokploy dev instance (canary @d768adb6a, Postgres 16.14, single-node swarm), application with rollbacks enabled against a local registry, two deployments, then Rollback:
HTTP 400, backend log showsPostgresError: cannot pass more than 100 arguments to a function (54023)raised fromfindRollbackById.rollbackApplication().Scope check on the same instance:
project.all,project.one,application.one,deployment.all,domain.byApplicationId,schedule.list,volumeBackups.listandpreviewDeployment.allall return 200 - they already narrow their nestedapplicationselection.Three other by-id finders do carry the identical un-narrowed shape and fail the same way on canary today. Calling them directly against the database (bypassing the routers) gives:
They are invisible from the API because their routers wrap the cause in a generic message the same way the rollback router does -
port.onereports "Port not found",schedule.oneandvolumeBackups.onelikewise - so the real error never reaches the client or the log. Unlike the rollback path, those three do read the nested data, so the correct fix there iscolumns:narrowing (the #4257 form) rather than dropping the relation. I kept this PR to the rollback path so it stays reviewable and independently verifiable; happy to send a follow-up for the other three, or to fold them in here if you prefer a single change.Checklist
Before submitting this PR, please make sure that:
canarybranch.Issues related (if applicable)
Same class of bug as #4256 / #4257 (
findPreviewDeploymentById).Screenshots (if applicable)
N/A - Backend query change, verified end to end as described above.