apitoolkit / apitoolkit-express

APItoolkit's Express client SDK.
https://apitoolkit.io/docs/sdks/nodejs/expressjs
MIT License
6 stars 4 forks source link

Different URL Path on error #26

Open Lekejosh opened 1 month ago

Lekejosh commented 1 month ago

Describe the bug URL paths are not displayed correctly on error. For example, the URL path /api/v1/login appears correctly on the API toolkit dashboard when the request is successful. However, when the same URL path returns a 4xx status code, the dashboard displays a new, altered instance of the path, such as /login.

To Reproduce Steps to reproduce the behavior:

  1. install the Node SDK on your express server, config the errorHandler and the expressMiddleware
  2. Send a request to an endpoint so that it returns a 2XX Status code
  3. Send another request to that same endpoint so that it returns a 4XX status code

Expected behavior When a URL path like /api/v1/login returns a 4xx status code, the dashboard should display the full URL path, /api/v1/login, consistently with the path used for successful requests. The dashboard should not alter the URL path to a different format, such as /login, upon encountering an error.

Screenshots attached is a screenshot and video

image

video

https://github.com/user-attachments/assets/21fc5c4b-c521-416f-b163-3a829faae02a

Desktop (please complete the following information):

dawkaka commented 1 month ago

Hi @Lekejosh, Thank you for opening the issue. I've been working on reproducing the bug and have encountered some similar issues. However, I haven't been able to replicate the issue you had. Please share a code snippet or more details to help me investigate further.

image

Lekejosh commented 1 month ago

Hi @dawkaka,

You are experiencing the same issue I am. If you examine the URLs in your screenshot for both scenarios, you will notice the following:

In normal scenarios, both URLs should be the same:

Both should have the same URL path. This discrepancy makes the dashboard less detailed and causes the graph to be somewhat scattered due to the difference in URLs between the success and error states.

dawkaka commented 1 month ago

I think the problem you had was something like this:

dawkaka commented 1 month ago

In the meantime, I'll implement a fix and you can try it out to see if it resolves your issue as well. I'll let you know as soon as the update is released.

Lekejosh commented 1 month ago

Ok, no problem @dawkaka

dawkaka commented 1 month ago

@Lekejosh I published a new version, can you try the latest apitoolkit-express SDK version and confirm if it fixes your issue?

Lekejosh commented 1 month ago

Okay @dawkaka will check it out soon and revert back. Thank you

Lekejosh commented 1 month ago

@dawkaka I've tested the new update, and there are no changes. I still have the same issue, did you test the release? If yes please share a screenshot of both Responses

Attached are my screenshot of the SDK version and the result image image

dawkaka commented 1 month ago

@Lekejosh Like I mentioned before, I couldn't reproduce your exact issue, I pushed a fix to a similar issue I found while trying to reproduce yours, and I was hoping it would fix yours too but it didn't. Could you please provide a code example that reproduces the issue? This will help me address and fix the problem more efficiently. Thank you!

image

Lekejosh commented 1 month ago

I'm doing something wrong then, maybe the way I set the errorHandler middleware, When I get to my PC, I will surely share @dawkaka