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: endpoints returning status code 500 #501

Open
wants to merge 3 commits into
base: staging
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion apps/admin-gateway/src/module.api/orders.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ export class OrdersController {
streamUpdates: true
}
return await lastValueFrom<ResponseWithStatus>(
this.ordersClient.send(QUEUE_MESSAGE.UPDATE_ORDER_STATUS, payload).pipe(
this.ordersClient.emit(QUEUE_MESSAGE.UPDATE_ORDER_STATUS, payload).pipe(
Copy link
Member

Choose a reason for hiding this comment

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

Incorrect. Send is the correct method. refer to line 69 in order-service.controller.ts

Copy link
Contributor Author

Choose a reason for hiding this comment

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

send returns 500.

Copy link
Member

Choose a reason for hiding this comment

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

Even so but that doesnt solve the underlying issue. Check if anything is getting returned

Copy link
Member

Choose a reason for hiding this comment

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

image

Wrap the code in the circle in an observable. lastValueFrom

Copy link
Member

Choose a reason for hiding this comment

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

Please learn to look at for root cause when debugging. If something doesnt make sense and it works, there is something definitely wrong

Copy link
Contributor Author

@afkzoro afkzoro Oct 26, 2024

Choose a reason for hiding this comment

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

The request body still reaches the orders controller if send or emit is used. The error is only thrown from the admin gateway.

Tested with and without the lastValueFrom observable

catchError<any, any>((error: IRpcException) => {
throw new HttpException(error.message, error.status)
})
Expand Down
2 changes: 1 addition & 1 deletion apps/admin-gateway/src/module.api/payment.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export class PaymentController {
data: undefined
}
return await lastValueFrom<ResponseWithStatus>(
this.paymentClient.send(QUEUE_MESSAGE.WALLET_UPDATE_PAYOUT, payload).pipe(
this.paymentClient.emit(QUEUE_MESSAGE.WALLET_UPDATE_PAYOUT, payload).pipe(
catchError<any, any>((error: IRpcException) => {
throw new HttpException(error.message, error.status)
})
Expand Down