Closed stevensacks closed 2 months ago
@stevensacks, can you please point me to what exact request handler you expect to be called?
I believe I tracked down the issue. Opened a fix at https://github.com/mswjs/interceptors/pull/640. Will propagate to MSW soon.
I'd love to know more details on the expected result. The error is not thrown anymore in your code, but nothing happens on the page. I can see the 302 response arriving as error
in your auth logic. That seems to be related to your application (maybe that's intentional?).
That is odd. Login was working before with the msw handler (inside the test folder) as written. I’ll look into it asap.
Seems to be a bug in remix-auth. It's not storing the session correctly.
Login succeeds Redirects to /profile Profile loader authenticator.isAuthenticated fails Redirects to /login
From the user side, it appears to never leave the login page.
We did release some fixes around redirects in MSW, but those are suppose to follow redirects correctly (that was never done before). They are also relevant to fetch only. In your case, you are using ClientRequest
in Node.js, so you can disregard this message.
I believe the underlying issue is fixed. We didn't cover one Request
constructor scenario when recording raw headers. I will propagate the fix to MSW, and you will have no errors in your auth logic.
The reason it wasn't redirecting to /profile after login was a mistake in my code. remix-auth's authenticator throws a redirect on success, but my try catch around it was handling it as if it was an error instead of rethrowing it. It's working now in 2.4.8.
Awesome! 🎉 Good job on figuring that out. Meanwhile, the fix is about ready. Will publish today.
This has been released in v2.4.9!
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'm still having the error TypeError: Cannot set property headers of [object Response] which has only a getter
See https://github.com/serlo/cloudflare-worker/pull/882
To reproduce, just clone the repo, check the branch dependabot/npm_and_yarn/msw-2.4.9
out, install with yarn
and runyarn test
Prerequisites
Environment check
msw
versionNode.js version
20.17.0
Reproduction repository
https://github.com/gaia-react/remix
Reproduction steps
npx create-remix@latest --template gaia-react/remix
npm install msw@2.4.8
(it's currently using 2.4.2 which is the last working version)npm run dev
to launch Remix serverpassw0rd
(zero for o) and click the Login buttonCurrent behavior
I'm using remix-auth to make the call to the login endpoint, but it doesn't make it to the defined MSW handler.
If you need the console log of the error to show up in the terminal process, add it here after line 21.
Expected behavior
Expect the API call to go through to the MSW handler, as it does in version 2.4.2.