Skip to content
Domain SDK
Esc
↑↓navigate↵open⌘Jpreview
On this page

Poll until a domain is active

Wait until a custom domain reaches the provider-reported active state with waitUntilActive: timeouts, intervals, AbortSignal cancellation, and Retry-After backoff.

const controller = new AbortController();
const active = await domains.waitUntilActive("app.customer.com", {
  timeoutMs: 5 * 60_000,
  intervalMs: 5_000,
  signal: controller.signal,
  onStatus(domain) {
    console.log(domain.status);
  },
});

The first check runs immediately and checks never overlap. Delays start at five seconds and back off by 1.5x up to 30 seconds, the default timeout is five minutes, and a longer Retry-After from the provider wins. Permanent errors stop polling at once. When a check returns a domain that isn’t active, polling calls shouldStop before it checks the deadline: a match rejects with VERIFICATION_FAILED, and by default it matches failed, since waiting won’t fix that (pass your own shouldStop(domain) to change the rule). Otherwise polling rejects with TIMEOUT once the deadline has passed, or early when a Retry-After would run past it. It rejects with ABORTED when the signal fires. It does not guarantee DNS propagation time.

If a domain never becomes active because its certificate stays pending, see Troubleshoot custom domain SSL certificates.

Read next: waitUntilActive.

Last updated on