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

Request payload is missing in Chrome immediately after a fetch in RTK Query #3716

Closed
alex-vukov opened this issue Sep 13, 2023 · 3 comments
Closed
Milestone

Comments

@alex-vukov
Copy link
Contributor

This is a actually caused by this bug in Chromium https://bugs.chromium.org/p/chromium/issues/detail?id=1058404
Here in the RTK Query repo https://github.com/reduxjs/redux-toolkit/blob/master/packages/toolkit/src/query/fetchBaseQuery.ts#L269
request.clone() is used which triggers the bug. This bug causes any Playwright or Puppeteer test which checks an outgoing fetch request's body to fail in Chrome.
The reason why I am logging this issue in your repo is because the Chromium bug has been open for 3 years and is still not resolved so I thought maybe there is an alternative way to copy the request contents in your code which doesn't use the clone() function. This would be a workaround until the Chromium bug is fixed. I myself can try to contribute with a PR.

@alex-vukov
Copy link
Contributor Author

From what I tested it seems pretty straightforward to change:

    const request = new Request(url, config)
    const requestClone = request.clone()

to

    const request = new Request(url, config)
    const requestClone = new Request(url, config)

@markerikson
Copy link
Collaborator

Fixed in 1.9.6, I believe.

@alex-vukov
Copy link
Contributor Author

I tested and it works. Thank you!

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