Skip to content

Commit

Permalink
fix: Return proper response on auth setup [DEV-4146] (#560)
Browse files Browse the repository at this point in the history
* fix: Return proper response on auth setup

* fix artifacts

* fix artifacts 2

* incerase timeout

* try larger runner

* Revert "try larger runner"

This reverts commit 0ffc68b.

---------

Co-authored-by: Radoslaw Kaminski <[email protected]>
  • Loading branch information
DaevMithran and Radoslaw Kaminski authored Jul 24, 2024
1 parent 844eba5 commit 690d854
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 6 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,9 @@ jobs:
if: always()
with:
name: playwright-report
path: playwright-report/
path: |
playwright-report/
test-results/
retention-days: 14
if-no-files-found: ignore

Expand Down
2 changes: 1 addition & 1 deletion playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,5 @@ export default defineConfig({
// Global timeout for overall test run in milliseconds
// By default, Playwright has no global timeout but suggests a "sensible limit" can be set if needed
// Docs: https://playwright.dev/docs/test-timeouts#global-timeout
globalTimeout: 15 * 60 * 1000,
globalTimeout: 30 * 60 * 1000,
});
2 changes: 1 addition & 1 deletion src/app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ class App {
})
);
// Authentication functions/methods
this.express.use(async (_req, _res, next) => await auth.setup(next));
this.express.use(async (_req, _res, next) => await auth.setup(_res, next));
this.express.use(async (_req, _res, next) => await auth.wrapperHandleAuthRoutes(_req, _res, next));
this.express.use(async (_req, _res, next) => await auth.withLogtoWrapper(_req, _res, next));
if (process.env.ENABLE_EXTERNAL_DB === 'true') {
Expand Down
6 changes: 3 additions & 3 deletions src/middleware/authentication.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Request, Response, NextFunction, response } from 'express';
import type { Request, Response, NextFunction } from 'express';
import { StatusCodes } from 'http-status-codes';

import * as dotenv from 'dotenv';
Expand Down Expand Up @@ -52,11 +52,11 @@ export class Authentication {
this.logToHelper = new LogToHelper();
}

public async setup(next: NextFunction) {
public async setup(response: Response, next: NextFunction) {
if (!this.isSetup) {
const _r = await this.logToHelper.setup();
if (_r.status !== StatusCodes.OK) {
return response.status(StatusCodes.BAD_GATEWAY).json({
return response.status(StatusCodes.BAD_GATEWAY).send({
error: _r.error,
});
}
Expand Down

0 comments on commit 690d854

Please sign in to comment.