Skip to content

Commit

Permalink
cwebhook logs enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
Sheetal-ayanworks committed Apr 25, 2024
1 parent 3a7b254 commit 873aa78
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/dev-webhook.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Build and deploy Node.js app to ECSsdc
on:
push:
branches:
- develop
- pipeline-implementation
paths:
- 'apps/webhook/**'
workflow_dispatch:
Expand Down
5 changes: 5 additions & 0 deletions apps/webhook/src/webhook.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export class WebhookService {

async webhookFunc(webhookUrl: string, data: object): Promise<Response> {
try {
console.log("webhookurl::" , webhookUrl)
const response = await fetch(webhookUrl, {
method: 'POST',
headers: {
Expand All @@ -96,6 +97,8 @@ export class WebhookService {
});

if (!response.ok) {
console.log("not ok response::" , response)
console.log("not ok response status::" , response.status)
this.logger.error(`Error in sending webhook response to org webhook url:`, response.status);
throw new InternalServerErrorException(ResponseMessages.webhook.error.webhookResponse);
}
Expand All @@ -107,11 +110,13 @@ export class WebhookService {

async webhookResponse(webhookUrl: string, data: object): Promise<object> {
try {
console.log("webhookurl::" , webhookUrl)
const webhookResponse = async (): Promise<Response> => this.webhookFunc(webhookUrl, data);
const response = await AsyncRetry(webhookResponse, this.retryOptions(this.logger));
return response;
} catch (error) {
this.logger.error(`Error in sending webhook response to org webhook url: ${error}`);
console.log("error webhook::" , error)
throw new RpcException(error.response ? error.response : error);
}
}
Expand Down

0 comments on commit 873aa78

Please sign in to comment.