Skip to content

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

feat: add proxy support for oauth flows (#5198)

Steffen Schmitzc442c4290e60
diff --git a/ee/package.json b/ee/package.json
index 4348058b1b..b54102aa90 100644
--- a/ee/package.json
+++ b/ee/package.json
@@ -27,6 +27,7 @@
"@langfuse/shared": "workspace:*",
"@opentelemetry/api": ">=1.0.0 <1.10.0",
"axios": "^1.7.7",
+ "https-proxy-agent": "^7.0.6",
"next": "^14.2.21",
"next-auth": "^4.24.11",
"zod": "^3.23.8"
diff --git a/package.json b/package.json
index e6e3785538..02c8aa8625 100644
--- a/package.json
+++ b/package.json
@@ -86,6 +86,9 @@
"jsonpath-plus": "10.0.7",
"nanoid": "^3.3.8",
"katex": "^0.16.21"
+ },
+ "patchedDependencies": {
}
}
}
diff --git a/packages/shared/package.json b/packages/shared/package.json
index bb24a8d783..2164a2bc6a 100644
--- a/packages/shared/package.json
+++ b/packages/shared/package.json
@@ -77,6 +77,7 @@
"dd-trace": "^5.23.1",
"decimal.js": "^10.4.3",
"exponential-backoff": "^3.1.1",
+ "https-proxy-agent": "^7.0.6",
"ioredis": "^5.4.1",
"kysely": "^0.27.4",
"langchain": "^0.3.6",
diff --git a/patches/[email protected] b/patches/[email protected]
new file mode 100644
index 0000000000..0bcf79c251
--- /dev/null
+++ b/patches/[email protected]
@@ -0,0 +1,26 @@
+diff --git a/core/lib/oauth/client.js b/core/lib/oauth/client.js
+index 52c51eb6ff422dc0899ccec31baf3fa39e42eeae..bc50c35bb617d0e86b68ca42f64d44b475ba4abb 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,12 @@ 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 = {};
++ if (provider.httpOptions) httpOptions = { ...provider.httpOptions };
++ 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 4fc6e3c266..dbef5af7f1 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -9,6 +9,11 @@ overrides:
nanoid: ^3.3.8
katex: ^0.16.21
+patchedDependencies:
+ hash: cczsf6i6qe2m2htirvgxjtoclu
+ path: patches/[email protected]
+
importers:
.:
@@ -46,12 +51,15 @@ importers:
axios:
specifier: ^1.7.7
version: 1.7.7
+ https-proxy-agent:
+ specifier: ^7.0.6
+ version: 7.0.6
next:
specifier: ^14.2.21
next-auth:
specifier: ^4.24.11
zod:
specifier: ^3.23.8
version: 3.23.8
@@ -196,6 +204,9 @@ importers:
exponential-backoff:
specifier: ^3.1.1
version: 3.1.1
+ https-proxy-agent:
+ specifier: ^7.0.6
+ version: 7.0.6
ioredis:
specifier: ^5.4.1
version: 5.4.1
@@ -213,7 +224,7 @@ importers:
version: 4.17.21
next-auth:
specifier: ^4.24.11
nodemailer:
specifier: ^6.9.15
version: 6.9.15
@@ -370,7 +381,7 @@ importers:
'@next-auth/prisma-adapter':
specifier: ^1.0.7
'@opentelemetry/api':
specifier: ^1.9.0
version: 1.9.0
@@ -581,6 +592,9 @@ importers:
graphql:
specifier: ^16.9.0
version: 16.9.0
+ https-proxy-agent:
+ specifier: ^7.0.6
+ version: 7.0.6
ioredis:
specifier: ^5.4.1
version: 5.4.1
@@ -604,7 +618,7 @@ importers:
next-auth:
specifier: ^4.24.11
next-query-params:
specifier: ^5.0.1
@@ -5425,10 +5439,6 @@ packages:
resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==}
engines: {node: '>= 6.0.0'}
- resolution: {integrity: sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==}
- engines: {node: '>= 14'}
-
resolution: {integrity: sha512-jRR5wdylq8CkOe6hei19GGZnxM6rBGwFl3Bg0YItGDimvjGtAvdZk4Pu6Cl4u4Igsws4a1fd1Vq3ezrhn4KmFw==}
engines: {node: '>= 14'}
@@ -7623,10 +7633,6 @@ packages:
resolution: {integrity: sha512-NmLNjm6ucYwtcUmL7JQC1ZQ57LmHP4lT15FQ8D61nak1rO6DH+fz5qNK2Ap5UN4ZapYICE3/0KodcLYSPsPbaA==}
engines: {node: '>= 14'}
- resolution: {integrity: sha512-wlwpilI7YdjSkWaQ/7omYBMTliDcmCN8OLihO6I9B86g06lMyAoqgoDpV0XqoaPOKj+0DIdAvnsWfyAAhmimcg==}
- engines: {node: '>= 14'}
-
resolution: {integrity: sha512-vK9P5/iUfdl95AI+JVyUuIcVtd4ofvtrOr3HNtM2yxC9bnMbEdp3x01OhQNnjb8IJYi38VlTE3mBXwcfvywuSw==}
engines: {node: '>= 14'}
@@ -12301,6 +12307,26 @@ snapshots:
- '@aws-sdk/client-sso-oidc'
- aws-crt
+ '@aws-sdk/[email protected](@aws-sdk/[email protected])':
+ dependencies:
+ '@aws-sdk/client-sts': 3.675.0
+ '@aws-sdk/core': 3.667.0
+ '@aws-sdk/credential-provider-env': 3.667.0
+ '@aws-sdk/credential-provider-http': 3.667.0
+ '@aws-sdk/credential-provider-process': 3.667.0
+ '@aws-sdk/credential-provider-sso': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
+ '@aws-sdk/credential-provider-web-identity': 3.667.0(@aws-sdk/[email protected])
+ '@aws-sdk/types': 3.667.0
+ '@smithy/credential-provider-imds': 3.2.4
+ '@smithy/property-provider': 3.1.7
+ '@smithy/shared-ini-file-loader': 3.1.8
+ '@smithy/types': 3.5.0
+ tslib: 2.6.3
+ transitivePeerDependencies:
+ - '@aws-sdk/client-sso-oidc'
+ - aws-crt
+ optional: true
+
dependencies:
'@aws-sdk/credential-provider-env': 3.667.0
@@ -12362,9 +12388,9 @@ snapshots:
dependencies:
'@aws-sdk/credential-provider-env': 3.667.0
'@aws-sdk/credential-provider-http': 3.667.0
- '@aws-sdk/credential-provider-ini': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))(@aws-sdk/[email protected])
+ '@aws-sdk/credential-provider-ini': 3.675.0(@aws-sdk/[email protected])
'@aws-sdk/credential-provider-process': 3.667.0
- '@aws-sdk/credential-provider-sso': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
+ '@aws-sdk/credential-provider-sso': 3.675.0(@aws-sdk/[email protected](@aws-sdk/[email protected]))
'@aws-sdk/credential-provider-web-identity': 3.667.0(@aws-sdk/[email protected])
'@aws-sdk/types': 3.667.0
'@smithy/credential-provider-imds': 3.2.4
@@ -12751,7 +12777,7 @@ snapshots:
'@azure/core-util': 1.11.0
'@azure/logger': 1.1.4
http-proxy-agent: 7.0.2
- https-proxy-agent: 7.0.4
+ https-proxy-agent: 7.0.6
tslib: 2.6.3
transitivePeerDependencies:
- supports-color
@@ -14289,10 +14315,10 @@ snapshots:
transitivePeerDependencies:
- '@types/react'
dependencies:
'@prisma/client': 5.22.0([email protected])
'@next/[email protected]': {}
@@ -17423,10 +17449,10 @@ snapshots:
'@typescript-eslint/eslint-plugin': 7.3.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
'@typescript-eslint/parser': 7.12.0([email protected])([email protected])
eslint-config-prettier: 9.1.0([email protected])
- eslint-import-resolver-alias: 1.1.2([email protected])
- eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
eslint-plugin-eslint-comments: 3.2.0([email protected])
eslint-plugin-jsx-a11y: 6.8.0([email protected])
@@ -17689,12 +17715,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
- dependencies:
- debug: 4.3.7([email protected])
- transitivePeerDependencies:
- - supports-color
-
@@ -19311,7 +19331,7 @@ snapshots:
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])([email protected])
eslint-plugin-jsx-a11y: 6.8.0([email protected])
eslint-plugin-react: 7.34.1([email protected])
eslint-plugin-react-hooks: 4.6.0([email protected])
@@ -19328,7 +19348,7 @@ snapshots:
dependencies:
eslint: 8.57.0
eslint-plugin-n: 16.6.2([email protected])
eslint-plugin-promise: 6.4.0([email protected])
@@ -19337,9 +19357,9 @@ snapshots:
eslint: 8.57.0
eslint-plugin-turbo: 1.13.4([email protected])
dependencies:
dependencies:
@@ -19354,8 +19374,8 @@ snapshots:
debug: 4.3.7([email protected])
enhanced-resolve: 5.17.1
eslint: 8.57.0
fast-glob: 3.3.2
get-tsconfig: 4.8.1
is-core-module: 2.15.1
@@ -19366,13 +19386,13 @@ snapshots:
- eslint-import-resolver-webpack
- supports-color
dependencies:
debug: 4.3.7([email protected])
enhanced-resolve: 5.17.1
eslint: 8.57.0
fast-glob: 3.3.2
get-tsconfig: 4.8.1
is-core-module: 2.15.1
@@ -19383,7 +19403,7 @@ snapshots:
- eslint-import-resolver-webpack
- supports-color
dependencies:
debug: 3.2.7
optionalDependencies:
@@ -19394,13 +19414,14 @@ snapshots:
transitivePeerDependencies:
- supports-color
dependencies:
debug: 3.2.7
optionalDependencies:
'@typescript-eslint/parser': 7.12.0([email protected])([email protected])
eslint: 8.57.0
- eslint-import-resolver-typescript: 3.6.1(@typescript-eslint/[email protected]([email protected])([email protected]))([email protected])([email protected])
+ eslint-import-resolver-node: 0.3.9
transitivePeerDependencies:
- supports-color
@@ -19417,7 +19438,7 @@ snapshots:
eslint: 8.57.0
ignore: 5.3.1
dependencies:
array-includes: 3.1.7
array.prototype.findlastindex: 1.2.4
@@ -19427,7 +19448,7 @@ snapshots:
doctrine: 2.1.0
eslint: 8.57.0
eslint-import-resolver-node: 0.3.9
hasown: 2.0.2
is-core-module: 2.15.1
is-glob: 4.0.3
@@ -20335,7 +20356,7 @@ snapshots:
dependencies:
- agent-base: 7.1.1
+ agent-base: 7.1.3
debug: 4.3.7([email protected])
transitivePeerDependencies:
- supports-color
@@ -20354,13 +20375,6 @@ snapshots:
transitivePeerDependencies:
- supports-color
- dependencies:
- agent-base: 7.1.1
- debug: 4.3.7([email protected])
- transitivePeerDependencies:
- - supports-color
-
dependencies:
agent-base: 7.1.3
@@ -22206,7 +22220,7 @@ snapshots:
dependencies:
type-fest: 2.19.0
dependencies:
'@babel/runtime': 7.26.0
'@panva/hkdf': 1.1.1
diff --git a/web/package.json b/web/package.json
index e96718d602..e339385cd0 100644
--- a/web/package.json
+++ b/web/package.json
@@ -113,6 +113,7 @@
"dompurify": "^3.1.5",
"fastest-levenshtein": "^1.0.16",
"graphql": "^16.9.0",
+ "https-proxy-agent": "^7.0.6",
"ioredis": "^5.4.1",
"ip-address": "^9.0.5",
"kysely": "^0.27.4",
diff --git a/web/src/env.mjs b/web/src/env.mjs
index 3567163c40..fe4f8ecc47 100644
--- a/web/src/env.mjs
+++ b/web/src/env.mjs
@@ -122,6 +122,8 @@ export const env = createEnv({
)
.optional()
.default(30 * 24 * 60), // default to 30 days
+ AUTH_HTTP_PROXY: z.string().url().optional(),
+ AUTH_HTTPS_PROXY: z.string().url().optional(),
// EMAIL
EMAIL_FROM_ADDRESS: z.string().optional(),
SMTP_CONNECTION_URL: z.string().optional(),
@@ -373,6 +375,8 @@ export const env = createEnv({
AUTH_DISABLE_USERNAME_PASSWORD: process.env.AUTH_DISABLE_USERNAME_PASSWORD,
AUTH_DISABLE_SIGNUP: process.env.AUTH_DISABLE_SIGNUP,
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,
// Email
EMAIL_FROM_ADDRESS: process.env.EMAIL_FROM_ADDRESS,
SMTP_CONNECTION_URL: process.env.SMTP_CONNECTION_URL,