Make preview URL creation idempotent and add custom domain support#21
Merged
Merged
Conversation
- createPreviewURL returns existing URL (200) instead of 409 when one already exists for the port - Add optional `domain` field to creation request; validates it matches the org's verified custom domain and registers with Cloudflare - Include `customHostname` in create/list responses when the org has a custom domain - Update TypeScript and Python SDKs with `domain` parameter and `customHostname` field - Update test-preview-urls.ts to cover idempotent creation and custom domain flows Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
motatoes
added a commit
that referenced
this pull request
Mar 27, 2026
…custom-domains Make preview URL creation idempotent and add custom domain support
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.
Summary
POST /sandboxes/:id/previewnow returns the existing preview URL (200 OK) instead of 409 Conflict when one already exists for the portdomainfield in the request body. When provided, validates it matches the org's verified custom domain (DomainVerificationStatus == "active") and registers the hostname with CloudflarecustomHostnamein responses: Both create and list endpoints now includecustomHostnamewhen the org has a custom domain configureddomainparameter andcustomHostnamefieldtest-preview-urls.tscovers idempotent re-creation and optional custom domain flows viaCUSTOM_DOMAINenv varTest plan
npx tsx test-preview-urls.ts— verify idempotent creation passes (step 4)CUSTOM_DOMAIN=<verified-domain> npx tsx test-preview-urls.ts— verify custom domain creation and validationcustomHostnamefor orgs with custom domains🤖 Generated with Claude Code