From c6fd1731d5cc961b64159f824f863d471646ee40 Mon Sep 17 00:00:00 2001 From: wangdl Date: Wed, 27 May 2026 20:24:23 +0800 Subject: [PATCH] =?UTF-8?q?fix(auth):=20OnModuleInit=E6=94=B9=E4=B8=BAwarn?= =?UTF-8?q?=E8=80=8C=E9=9D=9Ethrow=EF=BC=8C=E9=81=BF=E5=85=8D=E7=94=9F?= =?UTF-8?q?=E4=BA=A7=E7=BC=BAAPPLE=5FBUNDLE=5FID=E6=97=B6=E8=BF=9B?= =?UTF-8?q?=E7=A8=8B=E5=B4=A9=E6=BA=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/auth/apple-auth.service.ts | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/modules/auth/apple-auth.service.ts b/src/modules/auth/apple-auth.service.ts index 2afe221..25c6148 100644 --- a/src/modules/auth/apple-auth.service.ts +++ b/src/modules/auth/apple-auth.service.ts @@ -27,12 +27,14 @@ export class AppleAuthService implements OnModuleInit { const nodeEnv = process.env.NODE_ENV; if (nodeEnv === 'production') { if (!this.appleBundleId) { - throw new Error( - '生产环境必须设置 APPLE_BUNDLE_ID 环境变量。\n' + + this.logger.error( + '生产环境未配置 APPLE_BUNDLE_ID!Apple 登录将返回 401。\n' + '请在 .env 中添加: APPLE_BUNDLE_ID=com.your.bundle.id', ); + // 不抛异常 — 拒绝启动会阻断整个服务。运行时已保证 401 拒绝。 + } else { + this.logger.log('Apple 登录已配置,使用真实验签'); } - this.logger.log('Apple 登录已配置,使用真实验签'); } else { if (this.appleBundleId) { this.logger.log('Apple 登录使用真实验签模式(已配置 bundleId)');