From 2e5fd10b382c0e7f3713b39da23681f2e34e72b8 Mon Sep 17 00:00:00 2001 From: Kenneth Obsequio Date: Thu, 30 Jul 2026 19:25:38 +0800 Subject: [PATCH] added: ipv4 based per locals In compliance with Google OAuth factor by providing real ipv4 bound from localost machine Signed-off-by: Kenneth Obsequio --- server.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/server.js b/server.js index 6c22b02..0855f2c 100644 --- a/server.js +++ b/server.js @@ -19,6 +19,16 @@ ***********************************************************************************************************************************************************************/ require('dotenv').config(); +// Force IPv4-only outbound connections. Hosts that resolve AAAA records but +// have no working IPv6 route (e.g. to Google's OAuth endpoints) hit ENETUNREACH +// on the v6 attempt — and Node's dual-stack "Happy Eyeballs" connector +// (autoSelectFamily) throws AggregateError instead of falling back cleanly to +// the reachable IPv4 address. dns.setDefaultResultOrder alone does NOT fix +// this (the connector still races both families); autoSelectFamily has to be +// disabled outright. See [AUTH] googleCallback OIDC error: AxiosError [AggregateError]. +require('net').setDefaultAutoSelectFamily(false); +require('dns').setDefaultResultOrder('ipv4first'); + const express = require('express'); const cors = require('cors'); const cookieParser = require('cookie-parser');