Skip to content

Commit 45ec9a8

Browse files
committed
fix(sso): state what a failed DNS lookup tells us instead of assigning blame
1 parent f5a3de6 commit 45ec9a8

2 files changed

Lines changed: 7 additions & 4 deletions

File tree

apps/sim/app/api/organizations/[id]/domains/[domainId]/verify/route.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,9 @@ describe('verify org domain route', () => {
8888
mockCheckDomainTxtRecord.mockResolvedValue('unavailable')
8989
const res = await POST(createMockRequest('POST'), routeContext)
9090
expect(res.status).toBe(503)
91-
expect(await res.json()).toMatchObject({ error: expect.stringContaining('on our side') })
91+
expect(await res.json()).toMatchObject({
92+
error: expect.stringContaining("couldn't complete the DNS lookup"),
93+
})
9294
expect(mockRecordAudit).not.toHaveBeenCalled()
9395
})
9496

apps/sim/app/api/organizations/[id]/domains/[domainId]/verify/route.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,13 +71,14 @@ export const POST = withRouteHandler(
7171
}
7272

7373
const lookup = await checkDomainTxtRecord(row.domain, row.verificationToken)
74-
// 503, not 422: the record may well be correct, so this must not read as the
75-
// admin's mistake or they will go hunting through DNS for a fault that is ours.
74+
// 503, not 422: we learned nothing about their record, so this must not read
75+
// as a missing one. SERVFAIL can mean either a fault of ours or a broken zone
76+
// of theirs, so the message states what we know rather than assigning blame.
7677
if (lookup === 'unavailable') {
7778
return NextResponse.json(
7879
{
7980
error:
80-
"We couldn't complete the DNS lookup — this is a problem on our side, not with your record. Try again in a few minutes.",
81+
"We couldn't complete the DNS lookup, so we can't tell yet whether your record is published. Try again in a few minutes — if it keeps failing, check that your domain's nameservers are responding.",
8182
},
8283
{ status: 503 }
8384
)

0 commit comments

Comments
 (0)