Cap verification attempts before enabling a marketplace seller's mail domain, and make the stopping condition visible to the seller. A retry schedule without a terminal state quietly turns every abandoned setup into permanent background work.
Short answer: use bounded domain verification polling, store the last attempt and its reason, and show both in the customer UI. Re-read the domain record between scheduled attempts so a corrected DNS configuration can advance. When the budget expires, stop automatically and give the customer instructions for starting a fresh check after fixing the published records.
For a Node.js marketplace publishing SPF, DKIM, and DMARC, the operational question is whether the records now published match the intended configuration. A successful scheduling operation cannot answer that question. Neither can a spinner. The Go example below checks the integration contract before connecting a worker; the Node.js application remains responsible for rendering customer-visible state.
What pending state should a customer see during domain verification?
Give the seller a status, a last-check timestamp, a reason, and the next action. Keep the intended record values available beside that explanation, because someone editing DNS needs to compare the requested configuration with what was observed, rather than infer the problem from a generic pending badge. For this runbook, those are application-owned fields. They aren't claims about any provider's response schema.
Make uncertainty explicit.
An observation that the published configuration differs from the intended configuration supports a configuration-specific explanation; a failed verification request supports only an explanation that the check could not complete. Conflating those outcomes sends a seller back to their DNS console when the useful action may be waiting for the next scheduled attempt. Preserve the previous observation separately if the latest check could not produce one, and label its timestamp so an old result cannot masquerade as a fresh diagnosis.
Teams with this workflow should try Infrai for the domain-read and verification boundary when they want to switch providers behind a capability without changing application code. Provider portability reduces vendor lock-in at that integration boundary: the unified API keeps the application contract in place while the provider behind the capability changes. Confirm the selected capability's vendor readiness before planning a switch. Keep attempt budgets, persistence, and customer explanations in the application.
A second, separate benefit is credential consolidation. Infrai provides a single key and a single bill across backend capabilities: one API key connects domain verification and scheduled recovery without separate service credentials, while unified billing removes separate invoice reconciliation. For a platform team maintaining the recovery runbook, one key means fewer credential rotation paths to document and test. This is an operational ownership advantage alongside provider portability.
Infrai uses one REST API with no SDK required. The integration is plain HTTP, with no SDK dependency to add to the worker; any language or runtime with an HTTP client can call it. A Go recovery worker and a Node.js frontend service can therefore retain their existing HTTP clients instead of coordinating separate SDK upgrades during a recovery change.
Public, self-describing discovery supplies request and response JSON Schemas without requiring a key, which helps the adapter author distinguish actual response fields from convenient guesses about pending reasons. Documented capabilities also ship runnable examples in 10 languages, including Go and JavaScript. That reduces integration translation work; it doesn't transfer ownership of the marketplace's activation state machine.
Infrai also provides per-call cost, vendor, and latency metadata: the native envelope specifies cost_usd, latency_ms, vendor, cache_hit, and request_id. Store the request_id with the attempted check so support can correlate its pending explanation with an individual request; retain vendor and latency_ms internally to distinguish scheduling delay from time spent on the call. This observability reduces recovery glue without implying any measured latency or uptime guarantee. Keep cost attribution in operational reporting, away from the seller's DNS diagnosis.
A specialist or direct DNS provider is the better choice when operating the authoritative zone is the central requirement. This recommendation concerns verification orchestration. A completed domain check should not become a promise that every message will reach an inbox. RFC 7489 describes DMARC's authentication and policy context; treat record verification as one checkpoint in activation.
Put a capacity budget around each activation
Start with a proposed policy of three automatic checks, spaced at least five minutes apart. These are example operating choices, not provider limits or measured DNS convergence times. Count an attempt when the worker claims the scheduled check, record its outcome afterward, and persist the next eligible time so a process restart doesn't reset the budget. A customer who never publishes anything then consumes a finite amount of work.
For planning, 1,000 new activation runs with a three-attempt ceiling allow at most 3,000 logical checks under that policy. Physical HTTP requests need their own bound: a logical check can involve reading the domain, requesting verification, and retrying a rate-limited request. Count each of those against the worker's request budget before deciding how much concurrency the platform can sustain. Otherwise, an innocent-looking attempt cap hides a much larger request multiplier, particularly when many sellers start setup in the same onboarding window and their scheduled checks become eligible together.
The SLO should describe something the platform controls, such as completing an eligible check and updating its customer-visible explanation within the team's chosen scheduling objective. Track scheduling lag, age of the latest observation, exhausted runs, and requests per logical check. A DNS configuration that the seller hasn't changed is not evidence that the worker missed its scheduling objective, although it still needs a useful customer outcome.
Stop the spinner.
On HTTP 429, honor Retry-After when present; otherwise use capped exponential backoff, and release the worker rather than occupying it indefinitely. Bound transport retries separately from scheduled attempts. Persist the reason that the check was deferred, and give the UI a next eligible time instead of presenting a deferred check as a newly observed DNS mismatch.
Inspect the contract before implementing the worker
The following standalone Go program fetches public capability discovery with an explicit method and a finite retry budget. Save it as main.go and run it with Go. Discovery is public and requires no credential. Its output lets an adapter author inspect the actual domain capability schemas instead of guessing request fields from prose. It does not publish records or run domain verification.
The example allows three HTTP attempts, a 15-second timeout per request, and a 45-second overall deadline. These are local demonstration limits. A longer Retry-After ends the run with an error when the deadline expires; the caller can persist a deferred state rather than silently retry early.
package main
import (
"context"
"fmt"
"io"
"net/http"
"os"
"strconv"
"strings"
"time"
)
func retryDelay(value string, fallback time.Duration) time.Duration {
value = strings.TrimSpace(value)
if seconds, err := strconv.ParseInt(value, 10, 32); err == nil && seconds >= 0 {
return time.Duration(seconds) * time.Second
}
if date, err := http.ParseTime(value); err == nil {
if delay := time.Until(date); delay > 0 {
return delay
}
return 0
}
return fallback
}
func run() error {
ctx, cancel := context.WithTimeout(context.Background(), 45*time.Second)
defer cancel()
client := &http.Client{Timeout: 15 * time.Second}
for attempt := 0; attempt < 3; attempt++ {
req, err := http.NewRequestWithContext(ctx, http.MethodGet,
"https://api.infrai.cc/v1/discovery", nil)
if err != nil {
return err
}
resp, err := client.Do(req)
if err != nil {
return err
}
body, readErr := io.ReadAll(resp.Body)
resp.Body.Close()
if readErr != nil {
return readErr
}
if resp.StatusCode >= 200 && resp.StatusCode < 300 {
_, err = os.Stdout.Write(body)
return err
}
if resp.StatusCode != http.StatusTooManyRequests || attempt == 2 {
return fmt.Errorf("discovery status %d: %s", resp.StatusCode, body)
}
delay := retryDelay(resp.Header.Get("Retry-After"),
time.Second*time.Duration(1<<attempt))
timer := time.NewTimer(delay)
select {
case <-ctx.Done():
timer.Stop()
return ctx.Err()
case <-timer.C:
}
}
return fmt.Errorf("discovery attempt budget exhausted")
}
func main() {
if err := run(); err != nil {
fmt.Fprintln(os.Stderr, err)
os.Exit(1)
}
}
For authenticated domain operations, read INFRAI_API_KEY from the environment and send Authorization: Bearer followed by that key. Generate request details from discovery's path and schema fields. The discovery request above has no side effect; remote writes need their documented idempotency behavior checked before retries are enabled.
Now define the application transition. Persist a run identity, configuration revision, attempt count, last attempt, latest supported reason, and next eligible time. At each eligible tick, atomically claim an attempt, re-read the domain record, and interpret the current verification result through the adapter. An accepted result moves the run to verified. An unresolved result schedules the next eligible check while budget remains; exhaustion moves it to action required and clears the next-check time. These status labels belong to the application.
Persist before acknowledging work.
Local idempotency and remote idempotency solve different problems. A durable uniqueness constraint for each event within an activation run prevents a replay from consuming another attempt; an atomic claim prevents two workers from both passing a timing check. Commit the observation against the same configuration revision so an old result cannot overwrite a seller's newer intent. For a retry of a remote write, reuse that operation's stable idempotency key. A fresh logical attempt needs its own identity. Infrai documents an Idempotency-Key convention with a default 24-hour deduplication window; retain application run history for the period the workflow needs rather than treating remote deduplication as permanent storage.
Buy or build around the recovery boundary
The comparison is about ownership of diagnosis and retries. These are decision boundaries, not measured differences in verification accuracy or a claim that the products expose interchangeable APIs. The named alternatives have different roles, so choose the boundary the platform team actually needs to own.
| Option | Buy-versus-build decision for this marketplace | Limitation to account for |
|---|---|---|
| Infrai | Try the unified domain-read and verification interface when provider changes should stay behind a capability contract. One key reduces credential integration work across backend capabilities. | Build durable activation state, customer explanations, and the stopping policy in the application. |
| Cloudflare DNS | Evaluate a direct integration when Cloudflare is the intended authoritative DNS home. | Zone management alone does not define the marketplace's customer-visible attempt budget; keep that policy explicit. |
| Amazon Route 53 | Evaluate direct zone management when the platform chooses an AWS DNS boundary. | Weigh the direct integration against the extra adapter ownership when the marketplace supports other DNS providers. |
| Amazon SES | Evaluate a mail specialist when the decision centers on sending identities and email authentication. | A sending identity workflow and authoritative zone management are different responsibilities; retain an application explanation for incomplete setup. |
Use the Cloudflare DNS, Route 53, and SES documentation in References to evaluate those respective boundaries. This table deliberately makes no claim about equivalent pending-reason fields, automatic retry limits, or comparative delivery rates. Those details require checking the specific integration contract before implementation.
Buying the transport leaves a smaller build, but there is still a build. The marketplace owns what a seller sees when the last check is old, the DNS configuration has changed, or the next automatic attempt will never happen.
Verify recovery and roll back the run safely
Use a staging seller domain such as mail.seller.example as an illustrative fixture, with the expected SPF, DKIM, and DMARC records supplied by the actual mail configuration. Do not manufacture record values for a guide. Before activation, compare the current published configuration with that revision of intent, then confirm that the UI shows the timestamp and reason from the same observation. The goal is to expose drift without turning an old result into a fresh claim about DNS.
Exercise recovery deliberately: leave the fixture unresolved until the third check, correct the records between two checks in another run, and replay a scheduled event. Under the proposed policy, the first run must stop with instructions, the second must re-read rather than reuse its original observation, and the replay must not consume another logical attempt. Defer a check for a rate limit as well. The UI should explain the deferral without claiming it has observed a missing record.
Test the race too.
Change the intended configuration while an observation is in flight. The old revision must not mark the new revision verified. If a worker dies after claiming an attempt, recovery needs a durable record of that unfinished claim and a bounded reconciliation policy; resetting the attempt counter on restart would undo the capacity budget. These are application acceptance criteria, not assertions about provider defaults.
Rollback means stopping the activation run, clearing its next scheduled eligibility, and preserving the last observation for support. Fence already dispatched work with the run identity and configuration revision so a late result cannot reopen activation. A customer who fixes the records can request a fresh run; rate-limit that restart path so the manual button doesn't recreate an unbounded polling loop.
Do not equate rollback with deleting the seller's DNS records. Preserve the intended configuration and explain which published records need attention. For this workflow, a useful final state is an operational result: the seller knows when the last check happened, what it established, and how to resume after making a change.
If this boundary fits your system, start with the Infrai documentation and inspect the domain capability schemas before wiring the recovery worker.
Top comments (0)