Browse Source

fix(server): better fix for the OAuth Discovery errors (#4695)

* fix(server/oauth): Handle errors from OAuth Discovery.

* fix(server/oauth): Better fix for OAuth discovery error.

* This doesn't break tests.

* Update server/tsconfig.json

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>

* Revert back to the mostly original way.

---------

Co-authored-by: Jason Rasmussen <jrasm91@gmail.com>
Skyler Mäntysaari 1 year ago
parent
commit
2f87463170
2 changed files with 3 additions and 3 deletions
  1. 2 2
      server/src/domain/auth/auth.service.ts
  2. 1 1
      server/tsconfig.json

+ 2 - 2
server/src/domain/auth/auth.service.ts

@@ -345,8 +345,8 @@ export class AuthService {
       }
 
       return new issuer.Client(metadata);
-    } catch (error: Error | any) {
-      this.logger.error(`Error in OAuth discovery: ${error}`, error?.stack);
+    } catch (error: any | AggregateError) {
+      this.logger.error(`Error in OAuth discovery: ${error}`, error?.stack, error?.errors);
       throw new InternalServerErrorException(`Error in OAuth discovery: ${error}`, { cause: error });
     }
   }

+ 1 - 1
server/tsconfig.json

@@ -8,7 +8,7 @@
     "experimentalDecorators": true,
     "allowSyntheticDefaultImports": true,
     "resolveJsonModule": true,
-    "target": "es2017",
+    "target": "es2021",
     "moduleResolution": "node16",
     "sourceMap": true,
     "outDir": "./dist",