Skip to content

Commit f8542af

Browse files
committed
wat
1 parent febf4e0 commit f8542af

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/lib/coordination.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -235,7 +235,16 @@ export async function coordinateAuth(
235235
})
236236

237237
// Get the actual port the server is running on
238-
const address = server.address() as AddressInfo
238+
let address = server.address() as AddressInfo | null
239+
if (!address) {
240+
await new Promise<void>((resolve) => server.once('listening', resolve))
241+
address = server.address() as AddressInfo | null
242+
}
243+
244+
if (!address) {
245+
throw new Error('Failed to get server address after listening event')
246+
}
247+
239248
const actualPort = address.port
240249
debugLog('OAuth callback server running', { port: actualPort })
241250

0 commit comments

Comments
 (0)