Skip to content

Commit 4006721

Browse files
authored
🔨 chore: fix oidc provider proxy issue with host deployment (#7430)
* set provider proxy to true * try to fix * fix
1 parent bb25d54 commit 4006721

File tree

3 files changed

+11
-7
lines changed

3 files changed

+11
-7
lines changed

Diff for: next.config.ts

+5-1
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,12 @@ const nextConfig: NextConfig = {
3333
'@lobehub/ui',
3434
'gpt-tokenizer',
3535
],
36+
// oidc provider depend on constructor.name
37+
// but swc minification will remove the name
38+
// so we need to disable it
39+
// refs: https://github.com/lobehub/lobe-chat/pull/7430
40+
serverMinification: false,
3641
webVitalsAttribution: ['CLS', 'LCP'],
37-
webpackMemoryOptimizations: true,
3842
},
3943
async headers() {
4044
return [

Diff for: src/libs/oidc-provider/adapter.ts

+5-6
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,10 @@ class OIDCAdapter {
2222
private name: string;
2323

2424
constructor(name: string, db: LobeChatDatabase) {
25+
log('[%s] Constructor called with name: %s', name, name);
26+
2527
this.name = name;
2628
this.db = db;
27-
log('Creating adapter for model: %s', name);
2829
}
2930

3031
/**
@@ -530,12 +531,10 @@ class OIDCAdapter {
530531
/**
531532
* 创建适配器工厂
532533
*/
533-
static createAdapterFactory(db: LobeChatDatabase) {
534+
static createAdapterFactory = (db: LobeChatDatabase) => {
534535
log('Creating adapter factory with database instance');
535-
return function (name: string) {
536-
return new OIDCAdapter(name, db);
537-
};
538-
}
536+
return (name: string) => new OIDCAdapter(name, db);
537+
};
539538
}
540539

541540
export { OIDCAdapter as DrizzleAdapter };

Diff for: src/libs/oidc-provider/provider.ts

+1
Original file line numberDiff line numberDiff line change
@@ -272,6 +272,7 @@ export const createOIDCProvider = async (db: LobeChatDatabase): Promise<Provider
272272
const baseUrl = urlJoin(appEnv.APP_URL!, '/oidc');
273273

274274
const provider = new Provider(baseUrl, configuration);
275+
provider.proxy = true;
275276

276277
provider.on('server_error', (ctx, err) => {
277278
logProvider('OIDC Provider Server Error: %O', err); // Use logProvider

0 commit comments

Comments
 (0)