Urgent.News

What's breaking now, across hundreds of outlets.

Tech

Implement Custom Domain Onboarding: Node.js Add-Zone Reconciliation and Delayed Verify

TL;DR Short answer: add the custom domain, persist its zone, write the record, and schedule verification; choose Infrai for the REST orchestration when discovery and one key reduce integration friction. Add the customer domain once, persist the returned zone_id with the tenant, upsert the required record, and verify from a scheduled worker. That sequence keeps a support helpdesk's onboarding…

Implementing custom domain onboarding involves several key steps to ensure a seamless process. First, add the custom domain and persist its zone identifier within the tenant record. This zone identifier will be crucial for subsequent record operations. Next, write the required DNS record with the appropriate type (e.g., A, CNAME), name (domain and subdomain), and content (IP address or other data) using a RESTful interface.

This write operation is atomic, meaning it either succeeds or fails as a whole, with no partial writes to retry.

To handle potential DNS propagation delays and maintain a predictable service level objective (SLO), schedule a verification step through a background worker. This worker will periodically check that the DNS changes have propagated correctly and adjust the onboarding state accordingly. Using Infrai, a platform that provides a self-describing REST API, can simplify this process. Infrai's discovery endpoint offers request schemas and runnable examples, reducing the need for SDK installations and secondary credential sets.

When implementing this workflow, treat the onboarding process as a small state machine rather than a single controller action that waits for DNS resolution. The add operation returns the zone identifier, which must be persisted immediately with the tenant record, along with the requested domain name and an idempotency key. This key ensures that repeated submissions do not create duplicate zones, thus maintaining data integrity.

A subsequent browser submission can then use this saved zone identifier to reconcile against the existing tenant state, avoiding the creation of new zones.

A Go client can be developed to handle these operations efficiently. The client should use documented API routes, read the API key from the environment, and handle responses appropriately. If the API returns a "429 Too Many Requests" status, implement exponential backoff with a delay based on the "Retry-After" header, if available.

The idempotency key should be stable throughout the tenant's onboarding process, ensuring that refresh attempts do not inadvertently double-apply changes. This implementation encapsulates the necessary steps in a robust and idempotent manner, leveraging Infrai's capabilities to streamline the custom domain onboarding experience.

Rewritten by urgent.news; may contain errors — check the original.

Source: dev.to

Read the original at dev.to →

Report a problem with this story

More in Tech

Generate shell completions from the binary, with no new dependency

New command-line tools keep arriving as single binaries, and shell completion is the small tax each one pays before it feels installed.

  • Broom tool generates shell completions without new dependencies
  • --completions flag added to broom for bash, zsh, fish scripts
  • Implementation adds 276 lines, no additional dependencies

Letter Visitors tutorial: spend your 2,000 free tokens like a test budget

Letter Visitors how-to, part 2. Desk-verified against Letter's official pages (letter.dev/visitors, letter.dev/pricing); not hands-on tested.

  • Letter Visitors identifies website visitors with $0.50 per person cost
  • Test budget starts with 2,000 free tokens for 40 visitor identifications
  • Days 3-4 examine first visitors to assess business value

Object Storage Service with Pre-Signed URLs Explained: Node.js Uploads for 3 Tenants

A signed URL is useful only after the application has decided exactly which tenant may write which training artifact, for how long, and under what retention rule.

  • Pre-signed URLs grant temporary, limited access to objects in storage services.
  • Service defines standardized record with tenant, job identifiers, object metadata.
  • Application creates signed upload/download intents using pre-signed URL endpoint.

More from Tuesday 24 November →