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

Axios stream aborts early during 204 response from prism cli. #6353

Open
carl-eton opened this issue Apr 16, 2024 · 0 comments
Open

Axios stream aborts early during 204 response from prism cli. #6353

carl-eton opened this issue Apr 16, 2024 · 0 comments

Comments

@carl-eton
Copy link

Describe the bug

Using Axios as part of my API tests to make calls to an API Gateway. To validate these calls match the API spec they are being routed through the prism proxy (https://docs.stoplight.io/docs/prism/72d69fb629de0-validation-proxy)

When testing some DELETE endpoints that return http 204 Axios just abruptly fails and is unable to capture the response.
It throws this exception, mentioning that the maxContentLength has been exceeded even though no maximum has been specified.
image
It seems like this error message is just a generic one that is shown when the stream is aborted. As the condition for it to be shown shouldn't occur when no max is set.
image
This is also confirmed because if I do provide a limit, the error messages still shows even though I'm not possibly exceeding the limit.
image

I think there issue is somewhere between prism proxy and axios, as based on the prism logs the request is being forwarded to the API, processed and returned, its just Axios throws this exception when processing the return.

I captured the request coming back from the prism proxy using wireshark and it looks like this:
image

and i can see in the prism logs that request succeeded
image

To Reproduce

Its a bit challenging to provide a sample application but the steps are as follows.

  1. Have some DELETE endpoint that returns 204 no content.
  2. Install prism proxy and point proxy to your environment
  3. Make Axios.delete call to the prism proxy and the request between prism and API will succeed but fail between prism and axios.
  4. Axios will throw exception.

Code snippet

No response

Expected behavior

I would expect that Axios can simply process this response and return the status code and headers like usual. It would also be better to have a clearer error message since what is shown in the error isn't really what's happening.

Axios Version

1.6.8

Adapter Version

No response

Browser

No response

Browser Version

No response

Node.js Version

20.11.1

OS

windows 10

Additional Library Versions

@stoplight/prism-cli 5.7.0

Additional context/Screenshots

No response

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

1 participant