Skip to content

Comments

feat(atproto): local handle resolution fallback in custom fetch#504

Draft
tompscanlan wants to merge 1 commit intomainfrom
feature/local-handle-resolution
Draft

feat(atproto): local handle resolution fallback in custom fetch#504
tompscanlan wants to merge 1 commit intomainfrom
feature/local-handle-resolution

Conversation

@tompscanlan
Copy link
Contributor

Summary

  • Extends createPlcFallbackFetch() to intercept .well-known/atproto-did requests for handles matching PDS_SERVICE_HANDLE_DOMAINS
  • Tries canonical DNS/.well-known path first (3s timeout), falls back to local PDS com.atproto.identity.resolveHandle
  • Fixes OAuth flows for custodial users with .pds.test handles in local Docker dev (no DNS for handle domain)
  • Reads PDS_URL and PDS_SERVICE_HANDLE_DOMAINS from config in initializeOAuthClient()

How it works

fetch("https://bob-jones.pds.test/.well-known/atproto-did")
  → Step 1: Try normal DNS fetch (3s timeout) → fails (no DNS for .pds.test)
  → Step 2: Try PDS resolveHandle → returns did:plc:3asjfargakqdqezbcqnhqfdm
  → Return synthetic Response("did:plc:3asjfargakqdqezbcqnhqfdm")

In dev/prod where DNS works, the normal path succeeds and PDS is never called.

Test plan

  • 28 unit tests passing (13 new handle resolution tests + 15 existing PLC fallback tests)
  • Verify in local Docker with restored prod PDS backup
  • Verify no regression in dev environment (DNS handles still resolve normally)

Extend createPlcFallbackFetch() to intercept .well-known/atproto-did
requests for handles matching PDS_SERVICE_HANDLE_DOMAINS. Tries the
canonical DNS/.well-known path first (3s timeout), then falls back to
the local PDS com.atproto.identity.resolveHandle XRPC method.

This fixes OAuth flows for custodial users with .pds.test handles in
local Docker environments where no DNS exists for the handle domain.
@tompscanlan tompscanlan marked this pull request as draft February 17, 2026 14:29
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