Skip to content

fix: add authSource and directConnection params to MongoDB connection URLs#4112

Open
manalkaff wants to merge 2 commits intoDokploy:canaryfrom
manalkaff:fix/mongodb-connection-url-missing-auth-params
Open

fix: add authSource and directConnection params to MongoDB connection URLs#4112
manalkaff wants to merge 2 commits intoDokploy:canaryfrom
manalkaff:fix/mongodb-connection-url-missing-auth-params

Conversation

@manalkaff
Copy link
Copy Markdown

@manalkaff manalkaff commented Mar 30, 2026

Summary

Changes

  • show-external-mongo-credentials.tsx: appended ?authSource=admin&directConnection=true to external connection URL
  • show-internal-mongo-credentials.tsx: appended ?authSource=admin&directConnection=true to internal connection URL

Test plan

  • Deploy a MongoDB instance in Dokploy
  • Navigate to the MongoDB credentials panel
  • Verify the External Connection URL includes ?authSource=admin&directConnection=true
  • Verify the Internal Connection URL includes ?authSource=admin&directConnection=true
  • Confirm the URLs connect successfully without manual modification

Greptile Summary

This PR fixes MongoDB authentication failures (issue #4105) by appending authentication query parameters to both the external and internal connection URLs displayed in the credentials panels. The change is minimal, targeted, and follows the correct MongoDB URI specification.

Key changes:

  • show-external-mongo-credentials.tsx: External connection URL now includes the authSource and directConnection query parameters
  • show-internal-mongo-credentials.tsx: Internal connection URL now includes the same query parameters

Notes:

  • Setting authSource to admin is the correct default authentication database for a MongoDB container, matching the typical Dokploy deployment model.
  • Setting directConnection to true is appropriate for standalone Docker-based MongoDB instances, but it is a hardcoded assumption. Users who configure a replica set or route traffic through a proxy may need to adjust these parameters manually.

Confidence Score: 5/5

Safe to merge — the changes are pure display-string fixes with no logic, state, or API impact.

Both changes are single-line string additions to credential display components. The parameters added are correct for the standard Dokploy MongoDB deployment model. The only finding is a P2 style note about directConnection being a hardcoded standalone-topology assumption, which does not block the merge.

No files require special attention.

Important Files Changed

Filename Overview
apps/dokploy/components/dashboard/mongo/general/show-external-mongo-credentials.tsx Appends authSource and directConnection query parameters to the external connection URL. Correct for standalone MongoDB containers; slash-before-query-string follows the MongoDB URI spec.
apps/dokploy/components/dashboard/mongo/general/show-internal-mongo-credentials.tsx Appends authSource and directConnection query parameters to the internal connection URL. Mirrors the external change; consistent and correct for the standard single-container deployment model.

Reviews (1): Last reviewed commit: "fix: add authSource and directConnection..." | Re-trigger Greptile

Greptile also left 1 inline comment on this PR.

(2/5) Greptile learns from your feedback when you react with thumbs up/down!

… URLs

Fixes Dokploy#4105 - MongoDB external and internal connection URLs were missing
required query parameters causing authentication failures.

Added ?authSource=admin&directConnection=true to both connection strings.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@manalkaff manalkaff requested a review from Siumauricio as a code owner March 30, 2026 12:54
@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. bug Something isn't working labels Mar 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MongoDB External and Internal Connection URLs Missing Required Parameters

1 participant