Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

feat: add auth timeout options and fix auth proxy setup (#10300)

Travis Powell3d99c4284498
diff --git a/package.json b/package.json
index a633f168a2..c2f502506a 100644
--- a/package.json
+++ b/package.json
@@ -93,6 +93,9 @@
"tar-fs": "^2.1.2",
"rollup@^4.0.0": "^4.22.4",
"@types/node-fetch": "^2.6.13"
+ },
+ "patchedDependencies": {
}
}
}
diff --git a/patches/[email protected] b/patches/[email protected]
new file mode 100644
index 0000000000..4e7a6f8e75
--- /dev/null
+++ b/patches/[email protected]
@@ -0,0 +1,38 @@
+diff --git a/core/lib/oauth/client.js b/core/lib/oauth/client.js
+index 52c51eb6ff422dc0899ccec31baf3fa39e42eeae..a921531be5aac7af5123745f69ba7ff7eae64929 100644
+--- a/core/lib/oauth/client.js
++++ b/core/lib/oauth/client.js
+@@ -1,5 +1,7 @@
+ "use strict";
+
++var HttpsProxyAgent = require('https-proxy-agent').HttpsProxyAgent;
++
+ Object.defineProperty(exports, "__esModule", {
+ value: true
+ });
+@@ -7,7 +9,24 @@ exports.openidClient = openidClient;
+ var _openidClient = require("openid-client");
+ async function openidClient(options) {
+ const provider = options.provider;
+- if (provider.httpOptions) _openidClient.custom.setHttpOptionsDefaults(provider.httpOptions);
++ let httpOptions = {};
++
++ // Preserve existing provider httpOptions
++ if (provider.httpOptions) httpOptions = { ...provider.httpOptions };
++
++ // Optional timeout from environment variable
++ if (process.env.AUTH_SSO_TIMEOUT) {
++ const timeout = parseInt(process.env.AUTH_SSO_TIMEOUT, 10);
++ if (!isNaN(timeout) && timeout > 0) {
++ httpOptions.timeout = timeout;
++ }
++ }
++
++ if (process.env.AUTH_HTTPS_PROXY || process.env.AUTH_HTTP_PROXY) {
++ httpOptions.agent = new HttpsProxyAgent(process.env.AUTH_HTTPS_PROXY || process.env.AUTH_HTTP_PROXY);
++ }
++
++ _openidClient.custom.setHttpOptionsDefaults(httpOptions);
+ let issuer;
+ if (provider.wellKnown) {
+ issuer = await _openidClient.Issuer.discover(provider.wellKnown);
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index fc24bded17..53c6cebe98 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -11,6 +11,11 @@ overrides:
rollup@^4.0.0: ^4.22.4
'@types/node-fetch': ^2.6.13
+patchedDependencies:
+ hash: x447yy4qrylml2g7vrfko5ivki
+ path: patches/[email protected]
+
importers:
.:
@@ -53,7 +58,7 @@ importers:
next-auth:
specifier: ^4.24.12
zod:
specifier: ^3.25.62
version: 3.25.62
@@ -242,7 +247,7 @@ importers:
version: 4.1.1
next-auth:
specifier: ^4.24.12
nodemailer:
specifier: ^7.0.10
version: 7.0.10
@@ -399,7 +404,7 @@ importers:
'@next-auth/prisma-adapter':
specifier: ^1.0.7
'@opentelemetry/api':
specifier: ^1.9.0
version: 1.9.0
@@ -645,7 +650,7 @@ importers:
next-auth:
specifier: ^4.24.12
next-query-params:
specifier: ^5.1.0
@@ -17711,10 +17716,10 @@ snapshots:
transitivePeerDependencies:
- '@types/react'
dependencies:
dependencies:
@@ -27181,7 +27186,7 @@ snapshots:
dependencies:
type-fest: 2.19.0
dependencies:
'@babel/runtime': 7.28.4
'@panva/hkdf': 1.2.1
diff --git a/web/src/env.mjs b/web/src/env.mjs
index 580fa06124..2412ce69d9 100644
--- a/web/src/env.mjs
+++ b/web/src/env.mjs
@@ -182,6 +182,7 @@ export const env = createEnv({
.default(30 * 24 * 60), // default to 30 days
AUTH_HTTP_PROXY: z.string().url().optional(),
AUTH_HTTPS_PROXY: z.string().url().optional(),
+ AUTH_SSO_TIMEOUT: z.number().optional(),
// EMAIL
EMAIL_FROM_ADDRESS: z.string().optional(),
SMTP_CONNECTION_URL: z.string().optional(),
@@ -519,6 +520,7 @@ export const env = createEnv({
AUTH_SESSION_MAX_AGE: process.env.AUTH_SESSION_MAX_AGE,
AUTH_HTTP_PROXY: process.env.AUTH_HTTP_PROXY,
AUTH_HTTPS_PROXY: process.env.AUTH_HTTPS_PROXY,
+ AUTH_SSO_TIMEOUT: process.env.AUTH_SSO_TIMEOUT,
// Email
EMAIL_FROM_ADDRESS: process.env.EMAIL_FROM_ADDRESS,
SMTP_CONNECTION_URL: process.env.SMTP_CONNECTION_URL,