msw: Consistent "TypeError: Failed to execute 'text' on 'Response': body stream already read" since v1.2.2
Prerequisites
- I confirm my issue is not in the opened issues
- I confirm the Frequently Asked Questions didn’t contain the answer to my issue
Environment check
- I’m using the latest
mswversion - I’m using Node.js version 14 or higher
Browsers
Chromium (Chrome, Brave, etc.)
Reproduction repository
https://github.com/JKapitein/msw-bodystream
Reproduction steps
yarn cypress-serve
Can reach it locally from this point if you want, or
yarn cypress-run
Current behavior
Failed to execute ‘text’ on ‘Response’: body stream already read
// src/utils/logging/serializeResponse.ts
var import_headers_polyfill9 = require("headers-polyfill");
async function serializeResponse(response2) {
return {
status: response2.status,
statusText: response2.statusText,
headers: (0, import_headers_polyfill9.flattenHeadersObject)((0, import_headers_polyfill9.headersToObject)(response2.headers)),
body: await response2.text()
};
}
Expected behavior
The request completes without throwing an error as in 1.2.1
About this issue
- Original URL
- State: closed
- Created a year ago
- Reactions: 46
- Comments: 18 (6 by maintainers)
Commits related to this issue
- fix: Downgrade msw version for msw issue at https://github.com/mswjs/msw/issues/1640 — committed to dannycahyo/crypto-market by dannycahyo a year ago
- Fiks parsing feil Versjon 1.2.2 av msw har en bug som gjør at det blir spyttet ut en del feil ifm. at msw forsøker å lese samme respons-stream flere ganger. Nedgraderer derfor til 1.2.1 som ikke gir ... — committed to navikt/veilarbdetaljerfs by slovrid a year ago
- Api error catching and loading state (#21) * Fiks parsing feil Versjon 1.2.2 av msw har en bug som gjør at det blir spyttet ut en del feil ifm. at msw forsøker å lese samme respons-stream flere g... — committed to navikt/veilarbdetaljerfs by stiansolliNAV a year ago
- Api error catching and loading state (#21) * Fiks parsing feil Versjon 1.2.2 av msw har en bug som gjør at det blir spyttet ut en del feil ifm. at msw forsøker å lese samme respons-stream flere gang... — committed to navikt/veilarbdetaljerfs by stiansolliNAV a year ago
- Pilot boks (#22) * Lagt til pilot info boks * Endret link til forms * Implementer mapping (#20) * Oppdater datatyper, legg til default verdi, formattering og feilhåndtering * FIX: uhåndte... — committed to navikt/veilarbdetaljerfs by SanneEdlandsommerstudent a year ago
- Api error catching and loading state (#21) * Fiks parsing feil Versjon 1.2.2 av msw har en bug som gjør at det blir spyttet ut en del feil ifm. at msw forsøker å lese samme respons-stream flere g... — committed to navikt/veilarbdetaljerfs by stiansolliNAV a year ago
- Pilot boks (#22) * Lagt til pilot info boks * Endret link til forms * Implementer mapping (#20) * Oppdater datatyper, legg til default verdi, formattering og feilhåndtering * FIX: uhåndte... — committed to navikt/veilarbdetaljerfs by SanneEdlandsommerstudent a year ago
- Lagt til gridoutline for videre paneler (#24) * Lagt til gridoutline for videre paneler * Implementer mapping (#20) * Oppdater datatyper, legg til default verdi, formattering og feilhåndtering ... — committed to navikt/veilarbdetaljerfs by SanneEdlandsommerstudent a year ago
- :alien: Fix MSW logging error by using the previous patch version This seems to be related to the querystring parameters. See mswjs/msw#1640 for more context and other people having the same issue. — committed to open-formulieren/open-forms-sdk by sergei-maertens a year ago
- :alien: Fix MSW logging error by using the previous patch version This seems to be related to the querystring parameters. See mswjs/msw#1640 for more context and other people having the same issue. — committed to open-formulieren/open-forms-sdk by sergei-maertens a year ago
- :alien: Fix MSW logging error by using the previous patch version This seems to be related to the querystring parameters. See mswjs/msw#1640 for more context and other people having the same issue. — committed to open-formulieren/open-forms-sdk by sergei-maertens a year ago
- :alien: Fix MSW logging error by using the previous patch version This seems to be related to the querystring parameters. See mswjs/msw#1640 for more context and other people having the same issue. — committed to open-formulieren/open-forms-sdk by sergei-maertens a year ago
- :alien: Fix MSW logging error by using the previous patch version This seems to be related to the querystring parameters. See mswjs/msw#1640 for more context and other people having the same issue. — committed to open-formulieren/open-forms-sdk by sergei-maertens a year ago
- Fix: bugs of deps - Yarn 1 has a bug with "string-width" (Ref. https://github.com/storybookjs/storybook/issues/22431#issuecomment-1630086092) - MSW has a bug with logging system (Ref. https://github.... — committed to jetsbee/react-inspiring-bookmark by jetsbee a year ago
- chore: `msw` 1.2.3 버전 업데이트하여 버그 수정 https://github.com/mswjs/msw/issues/1640 — committed to woowacourse-teams/2023-dong-gle by yogjin a year ago
- [FE] feat: `Header` 컴포넌트 구현 (#120) * feat: `WritingTable` 내부 배포한 블로그 로고 표시 기능 추가 * chore: `SidebarLeftIcon`,`SidebarRightIcon`,`SettingIcon` 추가 * feat: `Header` 컴포넌트 마크업 추가 * feat: `useOutle... — committed to woowacourse-teams/2023-dong-gle by yogjin a year ago
- chore: msw 1.2.3 버전으로 업데이트 - mswjs/msw#1640 — committed to woowacourse-teams/2023-car-ffeine by gabrielyoon7 a year ago
- feat: 충전기 고장 신고 기능을 구현한다 (#258) * feat: 충전소 및 충전기 제보 버튼 추가 * chore: target를 ESNext으로 변경 - 기존 es5 * feat: 충전기 신고 msw 로직 구현 * feat: 충전기 신고 확정을 확인하는 모달 구현 * feat: 충전기 신고 확정을 확인하는 기능 구현 ... — committed to woowacourse-teams/2023-car-ffeine by gabrielyoon7 a year ago
- [All] feat: 데모데이3차 동글 서비스 배포 (#207) * [BE] feat: 프로젝트 초기 설정 (#8) * [All] chore: 이슈/PR 템플릿 추가 (#4) * chore: 이슈 템플릿 추가 * chore: PR 템플릿 추가 * feat: 프로젝트 초기 설정 --------- Co-authored-by:... — committed to woowacourse-teams/2023-dong-gle by echo724 a year ago
- Upgrade MSW from 1.2.2 to 1.2.3 Reference-Url: https://github.com/mswjs/msw/issues/1640 Signed-off-by: Radoslaw Szwajkowski <rszwajko@redhat.com> — committed to rszwajko/forklift-console-plugin by rszwajko a year ago
Released: v1.2.3 🎉
This has been released in v1.2.3!
Make sure to always update to the latest version (
npm i msw@latest) to get the newest features and bug fixes.Predictable release automation by @ossjs/release.
I got the issue on any environment. downgrading to 1.2.1 (no carrot) fixed the issue.
I also consistently have this bug using either version
1.2.2(node 16.19.1) ornext(node 18.16.0). Works correctly with version1.2.1.Are you sure you did not just install the 1.2.2? If you use the ^ character in “msw”: “^1.2.1” it will download 1.2.2. The bug disappeared for me when using 1.2.1.
Having the same issue when using msw version
1.2.2.with@storybook/test-runner. No errors when using msw1.2.1🤷@kettanaito I guess I was wrong with my comment, that I had it also with
next. I rechecked my code and I saw that I have not triednextyet, so I guess, I had the problem with both node 16 and 18, but just with mws version1.2.2.@kettanaito I will try it with the next release and check if i still have this problem.
I am also getting the same error with v1.2.1. In my case, the error occurs when I make different HTTP requests, same path parameters and use multiple useQuery hooks at the same time. The error went away when I combined the two mock APIs used in the component error occured into one, but I’m having trouble because I originally wanted to separate these two APIs.
For what it’s worth, this happens very consistently to me when using Storybook, but if I use the built version
yarn build-storybookand serve that, it does not happen.Thanks for replying. First of all sorry if I deleted the message but I didn’t see you answer.
Second you’re right, I am in a monorepo and didn’t notice one of the packages was using the 1.2.2 and all the versions were then resolved to the last one.
I confirm the bug relates only to the 1.2.2