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');