Skip to content

Make preview URL creation idempotent and add custom domain support#21

Merged
motatoes merged 1 commit into
mainfrom
feat/preview-url-idempotent-and-custom-domains
Feb 28, 2026
Merged

Make preview URL creation idempotent and add custom domain support#21
motatoes merged 1 commit into
mainfrom
feat/preview-url-idempotent-and-custom-domains

Conversation

@motatoes

Copy link
Copy Markdown
Contributor

Summary

  • Idempotent creation: POST /sandboxes/:id/preview now returns the existing preview URL (200 OK) instead of 409 Conflict when one already exists for the port
  • Custom domain support on creation: New optional domain field in the request body. When provided, validates it matches the org's verified custom domain (DomainVerificationStatus == "active") and registers the hostname with Cloudflare
  • customHostname in responses: Both create and list endpoints now include customHostname when the org has a custom domain configured
  • SDK updates: TypeScript and Python SDKs updated with domain parameter and customHostname field
  • Updated test script: test-preview-urls.ts covers idempotent re-creation and optional custom domain flows via CUSTOM_DOMAIN env var

Test plan

  • Rebuild and restart server with new changes
  • Run npx tsx test-preview-urls.ts — verify idempotent creation passes (step 4)
  • Run CUSTOM_DOMAIN=<verified-domain> npx tsx test-preview-urls.ts — verify custom domain creation and validation
  • Test passing an unverified/mismatched domain returns 400
  • Verify list endpoint includes customHostname for orgs with custom domains
  • Verify hibernate/wake cycle preserves preview URLs

🤖 Generated with Claude Code

- 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>
@vercel

vercel Bot commented Feb 28, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
opensandbox Ready Ready Preview, Comment Feb 28, 2026 1:07am

Request Review

@motatoes motatoes merged commit 24b26d2 into main Feb 28, 2026
3 checks passed
motatoes added a commit that referenced this pull request Mar 27, 2026
…custom-domains

Make preview URL creation idempotent and add custom domain support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant