mirror of
https://github.com/documenso/documenso.git
synced 2026-04-25 13:55:59 +03:00
[GH-ISSUE #1834] SMTP environment variables from .env file are ignored by the application process in Docker environment #531
Open
opened 2026-02-26 18:47:27 +03:00 by kerem
·
26 comments
No Branch/Tag specified
main
chore/translations
feat/signing-required-field-colors
feat/add-field-overflow-settings
chore/extract-translations
release
feat/public-completed-document-access
feat/bulk-download
docs/signing-reminders
feat/document-file-conversion
feat/prefetch-intent-navigation-links
fix/lint-project
fix/replace-linter-with-biome
fix/security-improvements
perf/dynamic-import-posthog
deps/vite-8
chore/migrate-eslint-prettier-to-oxlint-oxfmt
chore/migrate-to-pnpm
feat/add-pdf-image-renderer
feat/add-embed-v2
fix/extract-emails
feat/table-toolbar-filters
copilot/sub-pr-2478
fix/recipients-send-500
feat/external-2fa-codes
feat/protect-signing-urls
fix/checkbox-checked-values
duncan/legacy-api-endpoints
chore/block-po-files-locally
fix/default-embed-v2-document-rejection-to-false
fix/fields-dialog-title-description
copilot/sub-pr-2323
copilot/sub-pr-2267
exp/autoplace-fields
chore/server-hostname-config
fix/template-add-signers
fix/add-field-drag-drop-colors
fix/envelope-updates
feat/allow-formdata
archive/1.13.2
copilot/add-billing-section-account-page
fix/field-coordinate-bounds
feat/update-user-via-admin-dashboard
feat/expiry-links
feat/team-dashboard
feat/change-radio-direction
feat/admin-create-user-with-org
archive/v1.12.11
feat/envelopes-polish
feat/add-attachments-reworked
fix/font-size-fields
feat/improve-resend-dialog
fix/download-certificate-audit-log-safari
fix/duplicate-document-by-id
feat/document-table-filters
fix/template-migration
exp/effect
fix/migrate-template-metadata
exp/keyboard-signature
feat/document-2fa-redo
feat/add-attachments
feat/billing-redirect-flow
fix/add-api-logging
fix/duplicate-document-template-review
feat/handle-redirectto-param
feat/document-processing-status-indicator
feat/customize-doc-audit-log-certificate
feat/document-2fa
feat/organisations-backup-pls
feat/audit-logs-on-completed-document
chore/webhook-trigger-multiselect
exp/bg
chore/single-signer-wording
fix/template-uploading
feat/bin-tab
fix/staging-test
feat/rr7
squish/rr7
archive/nextjs
power-signer
fix/field-placements
fix/team-member-invites
fix/checkbox-field-bugs
fix/leaderboard-query
fix/zapier-list-documents-endpoint
feat/dictate-signers
feat/allow-same-signer-email-multiple-times
wip/rr7-next
experiment/self-sign
fix/oidc-login-error
feat/document-qrcode
feat/mau
feat/copy-links-audit-logs
chore/december-dep-upgrades
wip/rr7
wip/rr7-auth-package
wip/rr7-better-auth-demo
experiment/what-if-user-ids-were-strings-instead-of-numbers
fix/refactor-api-routes
feat/add-owner-completed-email-setting
fix/embed-whitelabel-colors
feat/delete-archive
fun/sign-with-nose
expiry-links
chore/openpage-viral-metrics
fix/sitemap
feat/signing-reminder
feat/automated-fields-signature
feat/add-polish-translations
staging
fix/open-page
openpage-api-deploy
feat/pulumi
chore/angular-embed-docs
exp/next-15
chore/select-signer
feat/save-data-on-blur
feat/save-recipients-on-blur
feat/signature-color
feat/team-email-template
chore/documenso-url
chore/add-ctas
fix/docker-setup-and-documentation
fix/document-creation-timezone
feat/telemetry
feat/integration-animation
fix/render-deployment
feat/publicProfile
feat/redirect-templates
feat/passkey-dialog
fix/refactor-use-template
chore/resend-onUpdate
chore/subject-onBlur
fix/demo-trpc-duration
fix/self-signer-custom-email-message
fix/benchmark
feat/add-myself-as-signer-temp
feat/checkbox-type
feat/update-marketing-header
experiment/queue
feat/error-demo
feat/add-document-auth-options
feat/document-2fa-test
chore/status-widget
open-page-restructure
feat/document-passkey-test
chore/form-reset
fix/neon-db-migration-test
feat/public-profile
feat/launch-week-content
webhooks_plus_api
exp/custom-field-labels
feat/accept-text-signature
feat/document-version-history
fix/delete-recipient-owners
fix/whitespace-title
feat/refresh
exp/million
feat/doc-comments
ElTimuro-patch-1
feat/teams-slugify
pr/537
date-format-setting
exp/millionjs
feat/runtime-env
chore/next-14
feat/chat-with-documents
feat/plan-limits
fix/467-bugsafari-only-unable-to-copy-document-sharing-link
feat/admin-ui-manage-instance
feat/stripe-free-tier
fix/cascade-delete-share-links
feat/marketing-share-document
feat/single-player-mode-polish
feat/next-13-5-3
chore/github-templates
docs/render-deploy
chore/code-of-conduct
chore/team
feat/add-e2e-testing
docs/minor-readme-updatess
docs/dx
feat-early-adopters
feat/open-early-adopters
fix/432-signee-doc-version-doesnt-have-sticky-signing-area
fix/446-cancel-cta-does-nothing-when-a-signer-opens-the-document
fix/445-signer-name-not-persisting
feat/resend-transport
fix/incorrect-completed-stats
feat/update-email-templates
feat/mania
feat/copy-or-tweet
feat/add-design-system-page
feat/single-player-mode
feat/completed-share-link
feat/designsystem
feat/send-email
feat/custom-emails
blog/upcoming-blog-post
feat/single-player-mode-test
feat/reset-password
blog/selfhosting-blog-post
feat/redirect-signed-document
fix/og-description
feat/universal-upload
chore/readme
chore/blogposts
fix/building-documenso-description
feat/admin-ui-metrics
feat/avatar-fallback
feat/templates
feat/blog-post-next
fix/hide-user-selection
feat/disable-sign
feat/marketing-mobile-nav
chore/remove-console-log-warn
feat/add-email-field
fix/redirect-signin-to-dashboard
feat/blog-og-image
feat/redirect-on-send
feat/billing-page
feat/profile-password-form
fix/signature-color-dark-mode
feat/inbox
feat/promise-safety
readme
chore/reduce-refetch-time
feat/update-document-flow
feat/refactor-shared-components
feat/feature-flag
feat/document-authoring
feat/pie-chart-legend
feat/open-page
docs/add-gitpod-setup
docs/add-render-deploy
docs-coventional-commits
feat/table-actions
minor/updates-google-auth-refresh
feat/add-document-animation
feat/new-email-template
feat/password-reset
fix/send-error-double-send
fix/improve-stripe-webhook-endpoint
feat/support-custom-cert-paths
feat/DOC-170-add-name-field
fix/improve-general-styling
feat/DOC-210-sign-dialog-broken-on-second-opening
bugfix-#71/invalid-email-hint
chore/optimise-deps
test-pr
v2.9.1
v2.9.0
v2.8.1
v2.8.0
v2.7.1
v2.7.0
v2.6.1
v2.6.0
v2.5.1
v2.5.0
v2.4.0
v2.3.2
v2.3.1
v2.3.0
v2.2.8
v2.2.7
v2.2.6
v2.2.5
v2.2.4
v2.2.3
v2.2.2
v2.2.1
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.4
v1.7.2-rc.3
v1.7.2-rc.2
v1.7.2-rc.1
v1.7.2-rc.0
v1.7.1-rc.3
v1.7.1
v1.7.1-rc.2
v1.7.1-rc.1
v1.7.1-rc.0
v1.7.0
v1.7.0-rc.5
v1.7.0-rc.4
v1.7.0-rc.3
v1.7.0-rc.2
v1.7.0-rc.1
v1.7.0-rc.0
v1.6.1
v1.6.1-rc.1
v1.6.1-rc.0
v1.6.0
v1.6.0-rc.3
v1.6.0-rc.2
v1.6.0-rc.1
v1.6.0-rc.0
v1.5.6
v1.5.6-rc.4
v1.5.6-rc.3
v1.5.6-rc.2
v1.5.6-rc.1
v1.5.6-rc.0
v1.5.5-rc.8
v1.5.5
v1.5.5-rc.7
v1.5.5-rc.6
v1.5.5-rc.5
v1.5.5-rc.4
v1.5.5-rc.3
v1.5.5-rc.2
v1.5.5-rc.1
v1.5.5-rc.0
v1.5.4-rc.5
v1.5.4
v1.5.4-rc.4
v1.5.4-rc.3
v1.5.4-rc.2
v1.5.4-rc.1
v1.5.4-rc.0
v1.5.3-rc.1
v1.5.3
v1.5.3-rc.0
v1.5.2-rc.8
v1.5.2
v1.5.2-rc.7
v1.5.2-rc.6
v1.5.2-rc.5
v1.5.2-rc.4
v1.5.2-rc.3
v1.5.2-rc.2
v1.5.2-rc.1
v1.5.2-rc.0
v1.5.1
v1.5.1-rc.0
v1.5.0-rc.6
v1.5.0
v1.5.0-rc.5
v1.5.0-rc.4
v1.5.0-rc.3
v1.5.0-rc.2
v1.5.0-rc.1
v1.5.0-rc.0
v1.4.0-rc.0
v1.4.0
v1.3.2-rc.0
v1.3.1-rc.2
v1.3.1
v1.3.1-rc.1
v1.3.1-rc.0
v1.3.0-rc.2
v1.3.0
v1.3.0-rc.1
v1.3.0-rc.0
v1.2.3
v1.2.2
v1.2.1
v1.2.0
v1.1
v1.0
v0.9
before-prettier
0.9-developer-preview
Labels
Clear labels
Mirrored from GitHub Pull Request
Compliance
Stale
apps: marketing
apps: web
community
component: api
component: integrations
component: ui
duplicate
effort: low
effort: medium
good first issue
hacktoberfest
help wanted
needs triage
needs-replication
needs-testing
on-hold
osshack
priority: high
priority: low
priority: medium
pull-request
Mirrored from GitHub Pull Request
question
roadmap
status: assigned
status: blocked
status: in progress
status: triage
type: bug
type: bug
type: bug
type: documentation
type: enhancement
type: feature
wontfix
💎 Bounty
💰 Rewarded
💰 Rewarded
No labels
Compliance
Stale
apps: marketing
apps: web
community
component: api
component: integrations
component: ui
duplicate
effort: low
effort: medium
good first issue
hacktoberfest
help wanted
needs triage
needs-replication
needs-testing
on-hold
osshack
priority: high
priority: low
priority: medium
pull-request
question
roadmap
status: assigned
status: blocked
status: in progress
status: triage
type: bug
type: bug
type: bug
type: documentation
type: enhancement
type: feature
wontfix
💎 Bounty
💰 Rewarded
💰 Rewarded
Milestone
Clear milestone
No items
No milestone
Projects
Clear projects
No items
No project
Assignees
Clear assignees
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".
No due date set.
Dependencies
No dependencies set.
Reference
starred/documenso#531
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @limson8 on GitHub (Jun 11, 2025).
Original GitHub issue: https://github.com/documenso/documenso/issues/1834
Issue Description
When deploying Documenso v1.11.1 using the official Docker Compose method, the application completely ignores all SMTP_* environment variables set in the .env file. Although the configuration is correct and the variables are successfully loaded into the container's environment, the application still attempts to connect to a hardcoded or incorrect default address (127.0.0.1:2500) when trying to send an email (e.g., for a password reset). This results in an EBADNAME error, rendering the email functionality completely broken.
Steps to Reproduce
Set up a standard Linux (x86_64) server.
Use the official docker-compose.yml and .env files for deployment.
In docker-compose.yml, specify the image as documenso/documenso:v1.11.1.
In the .env file, correctly and completely configure all SMTP_* variables (e.g., using Google SMTP settings).
Start the services using sudo docker compose up -d. The services run, and user login works correctly.
Verify the environment variables inside the container by running sudo docker compose exec app printenv | grep SMTP. This command confirms that all SMTP_* variables and their values have been successfully loaded into the container's shell environment.
Trigger an email-sending action from the application's frontend (e.g., "Forgot Password").
Check the application logs using sudo docker compose logs -f app.
Expected Behavior
The application should read the SMTP_HOST (smtp.gmail.com), SMTP_PORT (587), and other related variables from the environment and attempt to connect to the configured mail server.
Current Behavior
The application log shows an attempt to connect to an invalid hostname 127.0.0.1:2500, which immediately fails with the error Error: queryA EBADNAME 127.0.0.1:2500. This proves that the Node.js process is not utilizing the environment variables that are present in its runtime environment.
Log Snippet:
Additional context:
Extensive troubleshooting has been performed to rule out configuration errors:
The docker-compose.yml was simplified to rely only on env_file to eliminate any variable override conflicts.
The .env file was recreated from scratch to rule out any hidden formatting issues (like CRLF vs LF).
Database connectivity and user authentication (with a manually created user) are working correctly.
The issue seems to be isolated to how the application process itself consumes the environment variables specifically for the SMTP feature.
Screenshots (optional)
No response
Operating System [e.g., Windows 10]
Linux (Ubuntu/Debian)
Browser [e.g., Chrome, Firefox]
Chrome
Version [e.g., 2.0.1]
documenso/documenso:v1.11.1
Please check the boxes that apply to this issue report.
@Dvalin21 commented on GitHub (Jun 14, 2025):
Can you share your compose and .env?
@limson8 commented on GitHub (Jun 14, 2025):
Thanks for the response
Compose
.env
@Dvalin21 commented on GitHub (Jun 14, 2025):
Add the following
This should make it work for the 587 port. Let me know if it doesnt
@limson8 commented on GitHub (Jun 14, 2025):
I have updated my .env file to include the NEXT_PRIVATE_SMTP_SECURE and NEXT_PRIVATE_SMTP_UNSAFE_IGNORE_TLS variables. I then completely rebuilt the environment using docker compose down && docker compose up -d to ensure all changes were applied.
The issue persists with the exact same error log. The application is still trying to connect to 127.0.0.1:2500.
To be sure this wasn't a configuration loading issue, I performed two final checks:
Verified the .env file was loaded correctly into the container's environment. The output of sudo docker compose exec app printenv | grep SMTP confirms all SMTP variables are correctly set inside the container:
Triggered the "Forgot Password" function again. The application log still produces the following error, proving it is not using the environment variables available to it:
@Dvalin21 commented on GitHub (Jun 14, 2025):
You need to also set
NEXT_PRIVATE_SMTP_TRANSPORT="smtp-auth"
I've never seen anyone having the "[]" or "()". I'm wondering if this is adding to the issue?
@limson8 commented on GitHub (Jun 14, 2025):
still not working....same log
and sry for the confuse, i was using
[REDACTED]as a placeholder to hide my passwordsheres my updated .env
@Dvalin21 commented on GitHub (Jun 15, 2025):
How do you jave it setup? Do you have it setup local only? Do you jave it behind reverse proxy?
@limson8 commented on GitHub (Jun 15, 2025):
I am running it on a remote Ubuntu 22.04 server using Docker Compose. The stack consists of two containers: documenso/documenso:v1.11.1 for the application and postgres:16-alpine for the database.
This is not a local-only setup. It is deployed on a live server.
And it is running behind an Nginx reverse proxy. The Nginx instance handles SSL termination for my public domain and forwards all traffic to the Documenso app container on port 3000.
Let me know if you need any other information. Thanks!
@Dvalin21 commented on GitHub (Jun 15, 2025):
What does your host and hostname files have in them?
@limson8 commented on GitHub (Jun 16, 2025):
/etc/hostname
mycompany-server/etc/hosts
@Dvalin21 commented on GitHub (Jun 16, 2025):
I don't know what your company server requirements are, but I noticed your still using 127.0.1.1. I have mine set up as
Example:
127.0.0.1 localhost mycompany-server
WARNING!!!
I am not a server export or admin.
Pretty sure you will know more than me. But it was just a thought.
@limson8 commented on GitHub (Jun 19, 2025):
Hi, thank you for the suggestion.
Although my original /etc/hosts file has a standard Ubuntu cloud-init configuration, I have followed your advice to rule out any possibilities.
I have now modified my /etc/cloud/templates/hosts.debian.tmpl file and rebooted the server. My /etc/hosts file now looks like this:
After rebuilding the containers with docker compose down && docker compose up -d, I triggered the "Forgot Password" function again. Unfortunately, the result is still the same. The application log still shows the Error: queryA EBADNAME 127.0.0.1:2500 error.
This confirms the issue is not related to the server's local hostname resolution. The application is still not consuming the SMTP environment variables.
@Dvalin21 commented on GitHub (Jun 21, 2025):
Sorry for the late response. I have you figured out the issue on this? Also, can you check what is listening on port 2500?
@limson8 commented on GitHub (Jun 24, 2025):
Hi, thanks for getting back to me.
No, the issue is still unresolved. The application log continues to show the Error: queryA EBADNAME 127.0.0.1:2500 when I trigger an email action.
As you requested, I checked to see if any service is listening on port 2500, returned nothing, which confirms that nothing is listening on that port.
Here is the command and its empty output:
This seems to reinforce the conclusion that the application is attempting to connect to a hardcoded, non-existent endpoint, rather than being influenced by a local service or a misconfiguration. The problem appears to be internal to the application's handling of SMTP configuration.
@Dvalin21 commented on GitHub (Jun 25, 2025):
Yeah, I'm not sure whats going on here. I've never had that issue before. Last resort, remove containers AND images and re-pull? Otherwise I'm out of ideas.
@ephraimduncan commented on GitHub (Jun 25, 2025):
Hi @limson8 sorry for the delay, looks like you have the wrong SMTP environmental variables.
Can you use these instead?
Since
NEXT_PRIVATE_SMTP_HOSTis undefined (because you set SMTP_HOST instead), the code falls back to the default hardcoded value127.0.0.1:2500heregithub.com/documenso/documenso@bb9ba80edb/packages/email/mailer.ts (L93)@limson8 commented on GitHub (Jun 26, 2025):
@ephraimduncan
Hi, thank you for the detailed information and your continued support.
I have an important update. I have now completely replaced my old SMTP variables with the new NEXT_PRIVATE_SMTP_* variables you provided, including NEXT_PRIVATE_SMTP_TRANSPORT. After rebuilding the containers, the original Error: queryA EBADNAME 127.0.0.1:2500 is now gone! This confirms the variable names were the primary issue.
However, I am now facing a new problem. When I trigger the "Forgot Password" function, the page hangs, and the application log shows a new error: Error: Connection timeout.
Here is the new log snippet:
It seems the application is now correctly trying to connect to smtp.gmail.com but is unable to get a response. Given this new ETIMEDOUT error, are there any other application-level settings or known issues that could be causing this?
Thanks again for your help.
@limson8 commented on GitHub (Jun 26, 2025):
@Dvalin21
I've done that multiple times and the result is exactly the same.
Thank you very much for your assistance. Although the issue hasn't been fully resolved yet, I truly appreciate the time and effort you've put into helping me!
@Dvalin21 commented on GitHub (Jun 26, 2025):
Thanks, I appreciate that, but @ephraimduncan right now is the real hero. He got us to a different error at least. Ill ook more at it in the morning
@limson8 commented on GitHub (Jun 26, 2025):
update
After working with my cloud provider (DigitalOcean) to ensure port 2525 was unblocked, I have now performed a definitive independent test.
The issue is 100% confirmed to be a bug within the Documenso Docker container.
Here is the proof:
1. Successful Test from the Host Server:
I installed a command-line mailer (
swaks) on the host server itself and ran a test using the exact same SendGrid credentials and port from my.envfile. The email was sent and received successfully. This proves that the server's network, the firewall rules, and the SendGrid credentials are all working perfectly.Here is the successful command:
2. Failure from the Documenso Container:
Immediately after the successful test above, I triggered the "Forgot Password" function in the Documenso application again. The application log still shows the same Error: Connection timeout.
Conclusion:
This demonstrates definitively that the host machine can establish a connection, but the application process inside the Docker container cannot. The problem lies somewhere within the container's networking stack or the application's mailer implementation.
I have exhausted
@Dvalin21 commented on GitHub (Jun 26, 2025):
So glad you were able to come to a conclusion. I hope now the devs will
research and get this fix!
On Thu, Jun 26, 2025 at 8:16 AM Jiayang @.***> wrote:
@mngsgoncalves commented on GitHub (Jul 1, 2025):
I'm being affected by this as well.
@Dvalin21 commented on GitHub (Jul 1, 2025):
Thats crazy, I didn't have that issue!! But I host my own email server, so maybe thats the only difference
@cch1985 commented on GitHub (Jul 17, 2025):
ive been ripping my hair out trying to figure this out. same issue exactly, and was able to test the API, and the SMTP from my host server and everything works, except getting a relaying denied 550 5.7.1 mailgun error when trying to push it through Documenso.
@Dvalin21 commented on GitHub (Jul 17, 2025):
Apparently there are something that are buggy. This has been an issue for a year and more
@meetjeremy commented on GitHub (Jul 25, 2025):
I'm running via docker compose and mailgun is working for me.
these are my .env settings..
I think you need to give NEXT_PRIVATE_ prefix
NEXT_PRIVATE_SMTP_TRANSPORT="smtp-auth"
NEXT_PRIVATE_SMTP_HOST="smtp.mailgun.org"
NEXT_PRIVATE_SMTP_PORT=587
NEXT_PRIVATE_SMTP_USERNAME="mailgun verified email" # mailgun domain email.. mg.domain.xyz
NEXT_PRIVATE_SMTP_PASSWORD="password"