Skip to content

Commit

Permalink
fix(#33): fixed client timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
JanssenBrm committed Jan 26, 2024
1 parent 9963945 commit 15b1790
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"@types/express-session": "^1.17.5",
"@types/jest": "27.0.2",
"@types/node": "^16.0.0",
"@types/openid-client": "^3.7.0",
"@types/supertest": "^2.0.11",
"@typescript-eslint/eslint-plugin": "^5.0.0",
"@typescript-eslint/parser": "^5.0.0",
Expand Down
7 changes: 6 additions & 1 deletion src/auth/bearer/bearer.strategy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Injectable, Logger } from '@nestjs/common';
import { PassportStrategy } from '@nestjs/passport';
import { Strategy } from 'passport-http-bearer';
import { ConfigService } from '../../config/config/config.service';
import { Client, IntrospectionResponse, Issuer } from 'openid-client';
import { Client, custom, IntrospectionResponse, Issuer } from 'openid-client';

export const buildBearerClient = async (configService: ConfigService) => {
const issuer = await Issuer.discover(
Expand All @@ -12,6 +12,11 @@ export const buildBearerClient = async (configService: ConfigService) => {
client_id: configService.get('auth.oidc.clientId'),
client_secret: configService.get('auth.oidc.clientSecret'),
});
client[custom.http_options] = (options: any) => ({
...options,
timeout: 5000,
retry: 2,
});
return client;
};

Expand Down

0 comments on commit 15b1790

Please sign in to comment.