Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(api): Remove double logging of Bridge errors #6864

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions apps/api/src/app/bridge/bridge.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,11 @@ export class BridgeController {
@Get('/status')
@UseGuards(UserAuthGuard)
async health(@UserSession() user: UserSessionData) {
const result = await this.getBridgeStatus.execute(
return this.getBridgeStatus.execute(
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that the HealthCheck type has a status error and is not currently used.

As part of future work, we will discuss whether Bridge errors must return a HealthCheck payload with status set to 'error'.

GetBridgeStatusCommand.create({
environmentId: user.environmentId,
})
);

return result;
}

@Post('/preview/:workflowId/:stepId')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,25 +11,14 @@ export class GetBridgeStatus {
constructor(private executeBridgeRequest: ExecuteBridgeRequest) {}

async execute(command: GetBridgeStatusCommand): Promise<HealthCheck> {
try {
const response = (await this.executeBridgeRequest.execute(
ExecuteBridgeRequestCommand.create({
environmentId: command.environmentId,
action: GetActionEnum.HEALTH_CHECK,
workflowOrigin: WorkflowOriginEnum.EXTERNAL,
statelessBridgeUrl: command.statelessBridgeUrl,
retriesLimit: 1,
})
)) as ExecuteBridgeRequestDto<GetActionEnum.HEALTH_CHECK>;

return response;
} catch (err: any) {
Logger.error(
`Failed to verify Bridge endpoint for environment ${command.environmentId} with error: ${(err as Error).message || err}`,
(err as Error).stack,
LOG_CONTEXT
);
throw err;
}
return (await this.executeBridgeRequest.execute(
ExecuteBridgeRequestCommand.create({
environmentId: command.environmentId,
action: GetActionEnum.HEALTH_CHECK,
workflowOrigin: WorkflowOriginEnum.EXTERNAL,
statelessBridgeUrl: command.statelessBridgeUrl,
retriesLimit: 1,
})
)) as ExecuteBridgeRequestDto<GetActionEnum.HEALTH_CHECK>;
}
}
Loading