Skip to content

service domain add succeeds before DNS is set up; the domain commands move off the deprecated custom domain API - #400

Merged
wmadden-electric merged 8 commits into
mainfrom
claude/service-domain-hostname-routes-4eee86
Nov 23, 2026
Merged

wmadden-electric merged 8 commits into
mainfrom
claude/service-domain-hostname-routes-4eee86

Conversation

@wmadden-electric

@wmadden-electric wmadden-electric commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Adding a custom domain used to fail until your DNS was already right. Now it succeeds at once and tells you what to publish.

Before (abridged):

$ prisma service domain add shop.acme.com --service my-api
✖ Verify ownership of shop.acme.com            SERVICE.DOMAIN_OWNERSHIP_REQUIRED
  DNS does not contain the TXT proof for this workspace.

You published the record, ran add again, and it failed again with SERVICE.DOMAIN_DNS_NOT_CONFIGURED until the second record was in place too.

After (abridged):

$ prisma service domain add shop.acme.com --service my-api
✔ Added shop.acme.com to my-api.
  hostname    shop.acme.com
  status      pending
  state       not_verified
  waiting on  Proof in DNS that this workspace owns the domain.
  dns TXT     _prisma-verification.shop.acme.com -> prisma-verification=3f9a (ttl 300)
  dns CNAME   shop.acme.com -> switchboard.cdg.prisma.build (ttl 300)

$ prisma service domain wait shop.acme.com --service my-api
✔ shop.acme.com is live at https://shop.acme.com

The decision

The five prisma service domain commands (add, show, retry, wait, delete) move from the Management API's custom domain routes to its newer hostname routes. The old routes are deprecated by prisma/pdp-control-plane#6113 and are removed 30 days after that deploys, so the CLI has to move before then.

Command names, arguments and flags do not change. The --json output and the error codes do change, because the new API models a custom domain differently: a hostname exists from the moment you add it, and "DNS is not ready" is a state it is in, not a reason to refuse it. Those breaking changes are listed in full below.

How a custom domain works now

A hostname serves a service once three things are true:

  1. The workspace has proved it owns the domain, by publishing a TXT record.
  2. The hostname's DNS points at Prisma, by a CNAME record.
  3. A TLS certificate has been issued. The platform does this by itself once 1 and 2 hold.

The API reports where a hostname stands in two fields, and the CLI passes both through unchanged:

  • status is pending until the hostname has gone live once, then active.
  • state says what the hostname is doing right now. active means it serves the service. Every other value names what is missing:
state Meaning Who acts next
not_verified ownership is not proved you: publish the TXT record
waiting_for_dns DNS does not point at Prisma you: publish the CNAME record
no_live_deployment the service has no live version you: deploy or promote
no_service the service was deleted you: add the hostname to another service
in_use_elsewhere another service holds the hostname whoever owns that service
provisioning_certificate, updating the platform is working nobody
certificate_failed the certificate could not be issued you: retry, after reading the platform's reason
update_failed the platform's last update failed and is being retried nobody, or retry to try now

One fact shapes two of the commands: the platform looks DNS up when a hostname is added and when someone asks it to check, not on a timer. So after you publish your records, something has to ask.

What each command does

  • add creates the hostname and prints the records still to publish. It does not need DNS, or a live version of the service, to be in place first. Adding a hostname the service already has shows the existing one (existing: true).
  • show prints status, state, what the hostname waits on, and the records still to publish.
  • retry asks the platform to check again: it looks the DNS records up, tries a failed update again, and orders a new certificate if the last one failed.
  • wait blocks until state is active. While the hostname waits for records you publish, it asks for a check every 30 seconds, so a record you publish mid-wait is noticed. It stops at once on a failed certificate or a deleted service, since waiting cannot fix those. On timeout it reports the state the hostname is still in.
  • delete removes the hostname from the service.

After add, show and retry, the suggested next command now carries --service, --project and --branch, so it works from any directory and on any branch.

How failures are worded

The certificate and the DNS checks are done by systems below the Management API, so the CLI learns of a failure second-hand. It words a failure by what it was given, not by guessing at the cause:

What the CLI was given Example What it prints
A case the API models, with the thing to fix ownership not proved, DNS not pointing at Prisma its own message, with the records to publish or the action to take
A message the API passes on from the system below why a certificate failed, why DNS was refused "Provisioning failed. The platform reported: …", with the message as given and no advice added
Nothing a user can act on a failed certificate with no reason, a 5xx answer "… failed for reasons we are not sure about. You can try again, or contact support."

The CLI adds no advice to a message it does not understand, because it cannot know the advice is true: about half of failed certificates are temporary and half need the customer to change something, and the platform cannot tell them apart. For the same reason the CLI does not print the platform's internal error after a failed update.

This rule is recorded in docs/product/error-conventions.md, which links to the control plane's document for every layer (prisma/pdp-control-plane#6138, not merged yet). Only the service domain commands follow it so far.

One hostname listed twice

The API accepts the same hostname on a service more than once, for example when it was also added in the Console. At most one of those entries holds the hostname, meaning it is the one that serves it or will. The CLI treats the entries as one hostname: show, retry and wait follow the entry that holds it (the oldest, while none does), and delete removes them all.

Breaking changes

--json: the domain object of add, show and retry

Field Change
id now the hostname's id, not a dom_… custom domain id
status pending or active. Was one of pending_dns, verifying, verified_routing_blocked, provisioning_tls, active, failed, removing
dnsRecords[] now the records still to publish. Each gains condition; ttl is always a number
serviceId can be null
url, type, foundryStatus, failureCategory removed
state, conditions, firstUnmetCondition, dnsDetail, ownershipExpiresAt, heldBy, setupUrl new

Unchanged: hostname, failureReason, certExpiresAt, createdAt, updatedAt, the target fields, existing on add, and the whole delete result. The wait result gains state. wait's progress events now carry the state in status and the API's status in data.domainStatus.

Piped output of show

It gains a state line and loses its failure line.

Error codes

Code Change
SERVICE.DOMAIN_OWNERSHIP_REQUIRED, SERVICE.DOMAIN_DNS_NOT_CONFIGURED, SERVICE.DOMAIN_CLOUDFLARE_PROXY removed: add succeeds and reports a state
SERVICE.DOMAIN_ALREADY_REGISTERED removed: the hostname is added, with state: in_use_elsewhere
SERVICE.NO_VERSIONS from domain add removed: the hostname is added, with state: no_live_deployment
SERVICE.DOMAIN_RETRY_NOT_ELIGIBLE removed: a check is always accepted
SERVICE.DOMAIN_RETRY_RATE_LIMITED new: retry got HTTP 429. It prints the API's message and the wait from Retry-After
SERVICE.DOMAIN_QUOTA_EXCEEDED now only for a service's hostname limit; HTTP 429 no longer raises it
SERVICE.DOMAIN_VERIFICATION_FAILED wait raises it for a failed certificate and now also for a deleted service
SERVICE.DOMAIN_VERIFICATION_TIMEOUT its why names the state the hostname is still in
SERVICE.DEPLOY_FAILED from a domain command on a 5xx answer, it no longer carries the API's message

I searched the sibling repositories (Composer, Alchemy, create-prisma, cloud-deploy-action) and found nothing that reads the service domain output. The docs site pages for these commands will need updating.

Also in this diff

  • @prisma/management-api-sdk 1.80.0 → 1.101.0, which has the new routes. packages/cli-engine changes only its dev dependency, so it needs no release.
  • One shared error-body type. The new SDK types an HTTP 400 as a list of validation issues, which nine local copies of the error-body type did not accept. They are replaced by one type in src/lib/management-api-error.ts. Behaviour is unchanged.
  • Docs: command-principles.md, error-conventions.md and the error reference are updated to match.

Tests

  • Unit tests are rewritten for the new routes and states.
  • packages/cli/e2e/service-domain.e2e.ts runs add, show, retry and delete against the real API, on a hostname under .example, which never resolves. wait cannot have a real success case without DNS for a domain the test account owns, so it stays on the coverage backlog; the file runs wait --timeout 0 to prove its read.

Known limits

  • add also creates the workspace's record that it intends to own the domain. No CLI command shows or removes that record yet.
  • Composer still calls the old routes, through Alchemy. That is separate work.
  • Cloudflare proxy detection has no equivalent in the new API. A proxied hostname shows as waiting_for_dns with the platform's reason.
  • wait ends on a single 5xx answer, although the hostname may still become active. This was already so.

Alternatives considered

  • Keep the old seven status values, mapped from the new state. Rejected: they describe steps the platform no longer has, several new states have no old equivalent, and the API's own fields are passed through unchanged everywhere else.
  • Keep failureCategory by deriving it from the reason's prefix. Rejected: every certificate failure in practice was labelled acme, whatever its cause, so the field told a script nothing.
  • Keep add failing until DNS is ready. Rejected: the API now creates the hostname either way, so a failure would leave the hostname added and tell the user it was not.
  • Have wait only read, never ask for a check. Rejected: a wait started after the records are published could then run to its timeout, because nothing looks DNS up again.
  • Have wait ask for a check after a failed certificate too. Rejected: that check orders a new certificate, and a workspace may order ten an hour.
  • Print the platform's own error text after a failed update. Rejected: it describes a fault inside the platform that the user cannot act on.
  • Rename SERVICE.DOMAIN_VERIFICATION_FAILED and SERVICE.DOMAIN_VERIFICATION_TIMEOUT, which now cover more than verification. Not done here, to keep the codes stable; cheap to do before release if wanted.

Agent: monet-19

🤖 Generated with Claude Code

The custom domain routes are deprecated and will be removed. add, show,
delete, retry and wait now use /v1/services/{serviceId}/urls and
/v1/urls/{id}, from @prisma/management-api-sdk 1.101.0.

add succeeds before DNS is set up and prints the records to publish.
show and wait report the hostname's status and state. retry asks for a
check, and explains HTTP 429 as the hourly limit of new certificates.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@coderabbitai

coderabbitai Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Explain Change →

Warning

Review limit reached

This review ran on the open-source allowance, not this organization's plan, because the pull request author doesn't have an assigned seat. Waiting won't change this — ask an organization admin to assign them a seat, or add seats in Billing if every seat is already assigned, then retry.

Next included review available in 49 minutes.

Check out review usage here.

View limit details

Limit details: You’ve used the included review currently available.

Learn how review limits work.

Review configuration:

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: ASSERTIVE
  • Plan: Advanced
  • Run ID: 5f37abd3-e668-46af-af98-799b693b2406
Commits

Reviewing files that changed from the base of the PR and between c982e9a and 45d0e40.

Files ignored due to path filters: 1

  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
Files selected for processing: 37

  • docs/product/command-principles.md
  • docs/product/error-conventions.md
  • docs/reference/error-reference.md
  • packages/cli-engine/package.json
  • packages/cli/e2e/service-domain.e2e.ts
  • packages/cli/package.json
  • packages/cli/src/cli.ts
  • packages/cli/src/commands/service/domain-add.ts
  • packages/cli/src/commands/service/domain-delete.ts
  • packages/cli/src/commands/service/domain-retry.ts
  • packages/cli/src/commands/service/domain-show.ts
  • packages/cli/src/commands/service/domain-wait.ts
  • packages/cli/src/commands/service/errors.ts
  • packages/cli/src/commands/service/presentation.ts
  • packages/cli/src/commands/service/results.ts
  • packages/cli/src/commands/service/target.ts
  • packages/cli/src/controllers/app-env-api.ts
  • packages/cli/src/controllers/project.ts
  • packages/cli/src/lib/address/address.ts
  • packages/cli/src/lib/app/app-provider.ts
  • packages/cli/src/lib/app/branch-database-api.ts
  • packages/cli/src/lib/app/domain-guidance.ts
  • packages/cli/src/lib/branch/list.ts
  • packages/cli/src/lib/bucket/provider.ts
  • packages/cli/src/lib/database/provider.ts
  • packages/cli/src/lib/management-api-error.ts
  • packages/cli/src/lib/project/provider.ts
  • packages/cli/tests/app-provider.test.ts
  • packages/cli/tests/domain-guidance.test.ts
  • packages/cli/tests/e2e-coverage.test.ts
  • packages/cli/tests/helpers/routing-url.ts
  • packages/cli/tests/management-api-error.test.ts
  • packages/cli/tests/service-domain-wait.test.ts
  • packages/cli/tests/service-domain.test.ts
  • packages/cli/tests/service-session.test.ts
  • packages/cli/tests/service-testkit.ts
  • packages/prisma/package.json
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

@pkg-pr-new

pkg-pr-new Bot commented Nov 23, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

npx https://pkg.pr.new/@prisma/cli@400
npx https://pkg.pr.new/@prisma/cli-engine@400

commit: 45d0e40

wmadden-electric and others added 3 commits November 23, 2026 15:37
Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
A service can list one hostname more than once. show, retry, wait and
add now follow the entry the platform routes the hostname through; the
earlier rule could pick an older entry that never becomes active.

Also: the add command owns its idempotency and the provider is a plain
API mapping; delete skips an entry someone else already deleted; a 429
on retry shows the API's own message; the JSON summary drops its
constant type field; a null error body no longer throws.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
When a service lists a hostname twice and the entry wait follows loses
the hostname to the other, wait now looks the hostname up again and
follows the holder. delete removes the holder last. Wording and test
gaps from the second review round are fixed.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric marked this pull request as ready for review November 23, 2026 04:56
@wmadden-electric
wmadden-electric marked this pull request as draft November 23, 2026 05:09
wmadden-electric and others added 3 commits November 23, 2026 16:52
…e user

A failure from a system below the API is internal, relayed or modelled.
A failed certificate's reason is relayed as given, with no advice added.
A failed platform update, a failed certificate with no reason and a wait
that times out while the platform is working say only that provisioning
failed for reasons we are not sure about. The platform's update error is
no longer shown, and retry's 429 prints the API's message and hint.

The rule is recorded in docs/product/error-conventions.md.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
Fixes from the review of the error-model change: wait's timeout no longer
calls a hostname the platform is still working on a failure; a 5xx
answer to a domain command says only that the operation failed; the DNS
refusal reason is relayed as given; show suggests retry, not wait, after
a failed update, and nothing after a deleted service.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
A failed update says the last update failed and is being retried. The
platform's reason for refusing a hostname's DNS is relayed beside a
failed certificate too. The CLI's doc no longer says a 4xx answer is
safe to relay as such. Help and reference wording brought in line.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric marked this pull request as ready for review November 23, 2026 06:10
@wmadden-electric
wmadden-electric marked this pull request as draft November 23, 2026 06:14
After a certificate retry that the platform refuses for DNS, the API
carries the same text as the certificate's reason and as the DNS reason.
The CLI printed both, run together. It now shows the certificate's
reason, and the DNS reason only when the certificate has none. A wait
that times out after a failed update offers the retry.

Co-Authored-By: Claude Fable 5.2 <[email protected]>
Signed-off-by: willbot <[email protected]>
Signed-off-by: Will Madden <[email protected]>
@wmadden-electric
wmadden-electric marked this pull request as ready for review November 23, 2026 06:15
@wmadden-electric wmadden-electric changed the title service domain commands call the Management API's hostname routes; add succeeds before DNS is set up service domain add succeeds before DNS is set up; the domain commands move off the deprecated custom domain API Nov 23, 2026
@wmadden-electric
wmadden-electric merged commit 224d79b into main Nov 23, 2026
16 checks passed
@wmadden-electric
wmadden-electric deleted the claude/service-domain-hostname-routes-4eee86 branch November 23, 2026 06:21
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.

2 participants