[Breaking: DEPLOY SERVER BEFORE FRONT] fix: allow custom domain without Cloudflare API key#17160
Conversation
Welcome!
Hello there, congrats on your first PR! We're excited to have you contributing to this project. |
Greptile SummaryThis PR enables self-hosted Twenty instances to use custom workspace domains without requiring Cloudflare API credentials. Previously, setting a custom domain would fail with an error if
Key changes:
Behavior:
Minor issues:
Confidence Score: 4/5
Important Files Changed
Sequence DiagramsequenceDiagram
participant User
participant WorkspaceResolver
participant CustomDomainManager
participant DnsManagerService
participant CloudflareAPI
participant Database
alt Cloudflare Configured
User->>WorkspaceResolver: Set custom domain
WorkspaceResolver->>CustomDomainManager: setCustomDomain()
CustomDomainManager->>DnsManagerService: registerHostname()
DnsManagerService->>DnsManagerService: isCloudflareConfigured() = true
DnsManagerService->>CloudflareAPI: Create custom hostname
CloudflareAPI-->>DnsManagerService: Hostname details
DnsManagerService-->>CustomDomainManager: Success
CustomDomainManager->>Database: Save domain to workspace
Database-->>User: Domain saved + DNS records
User->>WorkspaceResolver: Check domain status
WorkspaceResolver->>DnsManagerService: isHostnameWorking()
DnsManagerService->>CloudflareAPI: Check verification status
CloudflareAPI-->>DnsManagerService: Verification status
DnsManagerService-->>WorkspaceResolver: true/false
WorkspaceResolver->>Database: Update isCustomDomainEnabled
else Cloudflare NOT Configured (Manual Mode)
User->>WorkspaceResolver: Set custom domain
WorkspaceResolver->>CustomDomainManager: setCustomDomain()
CustomDomainManager->>DnsManagerService: registerHostname()
DnsManagerService->>DnsManagerService: isCloudflareConfigured() = false
DnsManagerService-->>CustomDomainManager: undefined (skip Cloudflare)
CustomDomainManager->>Database: Save domain to workspace
User->>WorkspaceResolver: Get DNS records
WorkspaceResolver->>DnsManagerService: getHostnameWithRecords()
DnsManagerService->>DnsManagerService: isCloudflareConfigured() = false
DnsManagerService->>DnsManagerService: getManualDnsRecords()
DnsManagerService-->>WorkspaceResolver: Manual CNAME instructions
WorkspaceResolver-->>User: Configure DNS manually
User->>WorkspaceResolver: Check domain status
WorkspaceResolver->>DnsManagerService: isHostnameWorking()
DnsManagerService->>DnsManagerService: isCloudflareConfigured() = false
DnsManagerService-->>WorkspaceResolver: true (always, no verification)
WorkspaceResolver->>Database: Update isCustomDomainEnabled = true
end
|
|
🚀 Preview Environment Ready! Your preview environment is available at: http://bore.pub:26608 This environment will automatically shut down when the PR is closed or after 5 hours. |
When CLOUDFLARE_API_KEY is not set, custom domains can still be saved and users can configure their DNS manually. This enables self-hosted instances to use workspace custom domains without requiring Cloudflare integration. Changes: - DnsManagerService now gracefully handles missing Cloudflare configuration - Added isCloudflareConfigured() method to check if Cloudflare is available - Methods return manual DNS configuration instructions when Cloudflare is not set - isHostnameWorking() returns true in manual mode (user responsibility) - Added tests for non-Cloudflare scenarios Fixes twentyhq#17101 Signed-off-by: Vedant Madane <6527493+VedantMadane@users.noreply.github.com>
1b9ba97 to
8a54e88
Compare
|
Thanks @VedantMadane! What you did was good but I still think we don't want to support this feature for now. This is a very niche use-case and we're trying to make Twenty much more stable and bug-free, that means reducing the surface area and not exposing this which wouldn't be properly tested (our only production use-case is with Cloudflare so if we were to break this we wouldn't see it). |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.
This PR is being reviewed by Cursor Bugbot
Details
You are on the Bugbot Free tier. On this plan, Bugbot will review limited PRs each billing cycle.
To receive Bugbot reviews on all of your PRs, visit the Cursor dashboard to activate Pro and start your 14-day free trial.
There was a problem hiding this comment.
1 issue found across 10 files (changes from recent commits).
Prompt for AI agents (all issues)
Check if these issues are valid — if so, understand the root cause of each and fix them.
<file name="packages/twenty-front/src/pages/settings/domains/SettingsDomain.tsx">
<violation number="1" location="packages/twenty-front/src/pages/settings/domains/SettingsDomain.tsx:233">
P1: Custom domain UI is hidden when Cloudflare integration is disabled, blocking manual custom domain configuration</violation>
</file>
Reply with feedback, questions, or to request a fix. Tag @cubic-dev-ai to re-run a review.
| <SettingsPageContainer> | ||
| <SettingsSubdomain /> | ||
| <SettingsCustomDomain /> | ||
| {isCloudflareIntegrationEnabled && <SettingsCustomDomain />} |
There was a problem hiding this comment.
P1: Custom domain UI is hidden when Cloudflare integration is disabled, blocking manual custom domain configuration
Prompt for AI agents
Check if this issue is valid — if so, understand the root cause and fix it. At packages/twenty-front/src/pages/settings/domains/SettingsDomain.tsx, line 233:
<comment>Custom domain UI is hidden when Cloudflare integration is disabled, blocking manual custom domain configuration</comment>
<file context>
@@ -226,7 +230,7 @@ export const SettingsDomain = () => {
<SettingsPageContainer>
<SettingsSubdomain />
- <SettingsCustomDomain />
+ {isCloudflareIntegrationEnabled && <SettingsCustomDomain />}
</SettingsPageContainer>
</SubMenuTopBarContainer>
</file context>
24e6d57 to
ab967a7
Compare
|
Hey @FelixMalfait! After you've done the QA of your Pull Request, you can mark it as done here. Thank you! |
…ut Cloudflare API key (twentyhq#17160) ## Summary Fixes twentyhq#17101 When self-hosting TwentyCRM, users can now set workspace custom domains without requiring CLOUDFLARE_API_KEY to be configured. This enables manual DNS configuration for those not using Cloudflare. ## Changes - Added isCloudflareConfigured method to DnsManagerService - Modified all Cloudflare-dependent methods to gracefully handle missing configuration - Added getManualDnsRecords helper that provides DNS configuration instructions when Cloudflare is not available - isHostnameWorking returns true in manual mode, allowing the domain to be saved and enabled - Added comprehensive tests for non-Cloudflare scenarios ## Behavior When CLOUDFLARE_API_KEY is set: Works exactly as before with automatic Cloudflare provisioning When CLOUDFLARE_API_KEY is NOT set: - Custom domain can be saved to the database - User receives manual DNS configuration instructions - Domain is marked as working, user is responsible for external DNS and TLS configuration ## Testing Added tests covering non-Cloudflare scenarios. Full test suite requires Docker which was not run locally. <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Introduces a Cloudflare integration feature flag and wires it through server and front to gate the custom domain UI. > > - Server: adds `isCloudflareIntegrationEnabled` to `ClientConfig`, computed from `CLOUDFLARE_API_KEY` and `CLOUDFLARE_ZONE_ID` in `client-config.service`; updates GraphQL schema and unit tests. > - Frontend: adds `isCloudflareIntegrationEnabledState`, extends `ClientConfig` type, sets the flag in `useClientConfig`, and conditionally renders `SettingsCustomDomain` in `SettingsDomain` when enabled. > - Updates mocked client config to include the new flag. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit 0c76dde. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Signed-off-by: Vedant Madane <6527493+VedantMadane@users.noreply.github.com> Co-authored-by: Félix Malfait <felix@twenty.com> Co-authored-by: Félix Malfait <felix.malfait@gmail.com>
Summary
Fixes #17101
When self-hosting TwentyCRM, users can now set workspace custom domains without requiring CLOUDFLARE_API_KEY to be configured. This enables manual DNS configuration for those not using Cloudflare.
Changes
Behavior
When CLOUDFLARE_API_KEY is set: Works exactly as before with automatic Cloudflare provisioning
When CLOUDFLARE_API_KEY is NOT set:
Testing
Added tests covering non-Cloudflare scenarios. Full test suite requires Docker which was not run locally.
Note
Introduces a Cloudflare integration feature flag and wires it through server and front to gate the custom domain UI.
isCloudflareIntegrationEnabledtoClientConfig, computed fromCLOUDFLARE_API_KEYandCLOUDFLARE_ZONE_IDinclient-config.service; updates GraphQL schema and unit tests.isCloudflareIntegrationEnabledState, extendsClientConfigtype, sets the flag inuseClientConfig, and conditionally rendersSettingsCustomDomaininSettingsDomainwhen enabled.Written by Cursor Bugbot for commit 0c76dde. This will update automatically on new commits. Configure here.