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

Different URL Path on error #26

Open
Lekejosh opened this issue Jul 21, 2024 · 10 comments
Open

Different URL Path on error #26

Lekejosh opened this issue Jul 21, 2024 · 10 comments
Assignees

Comments

@Lekejosh
Copy link

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

Recording.2024-07-21.134928.1.1.mp4

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • Node version 20.12.0
  • Code Version: apitoolkit-express v2.4.3
@dawkaka
Copy link
Contributor

dawkaka commented Jul 22, 2024

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
Copy link
Author

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:

  • 200 POST /v1/api/hello/:name
  • 403 POST /v1/api

In normal scenarios, both URLs should be the same:

  • 200 POST /v1/api/hello/:name
  • 403 POST /v1/api/hello/:name

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
Copy link
Contributor

dawkaka commented Jul 22, 2024

I think the problem you had was something like this:

  • 200 POST /v1/api/hello/:name
  • 403 POST /hello/:name

@dawkaka
Copy link
Contributor

dawkaka commented Jul 22, 2024

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
Copy link
Author

Ok, no problem @dawkaka

@dawkaka
Copy link
Contributor

dawkaka commented Jul 23, 2024

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

@Lekejosh
Copy link
Author

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

@Lekejosh
Copy link
Author

@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
Copy link
Contributor

dawkaka commented Jul 25, 2024

@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
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants