-
-
Notifications
You must be signed in to change notification settings - Fork 517
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
MSW Server seems to prevent Axios timeout errors even when not started #284
Comments
Hey, @thomasmery. The Commenting out
I'm not sure I understand your intention in terms of Axios timeout. Do I understand it correctly that you want:
Which of the last 2 do you wish to cover in your request handlers? Perhaps, attach your request handlers so it's more evident what you are trying to do. Thanks. |
thanks, I'll try and be more precise all I want to do is to revert to a normal behaviour if I'm not starting the msw server in this case it is producing a timeout error when neither my local api server nor the msw server are started as for the browser side of msw (the worker) it is not started either when I experience the behaviour I'm talking about (I also checked by commenting it out and also if I do comment out the then the behaviour is what I expect i.e. letting the try catch block in my export const getServerSideProps: GetServerSideProps<Props> = async () => {
try {
const response = await getAllBacklinks();
const allBacklinks = response.data;
return {
props: {
allBacklinks,
},
};
} catch (serverError) {
return {
props: {
serverError: formatAxiosError(serverError),
},
};
}
}; |
also, maybe to clarify, if I start the app with mocking enabled and try to access a Next Page where the could I expect the timeout to be triggered? maybe it is very Axios oriented but I fail to understand what could cause this |
I think I have found the problem. I'm submitting a PR on |
The fix has been published in $ npm ls node-request-interceptor
[email protected]
└── [email protected] |
Environment
i'm using the setup @kettanaito proposes for a NextJs app : vercel/next.js#13731
I have setup a timeout for my API requests with Axios
I have de-activated the API to see the request fail after the timeout
and I am preventing the msw server to start by commenting out this line in
next.config.js
//server.listen();
Current behavior
I can't access the page I am requesting as the browser hangs
Expected behavior
As happens when I don't use msw or when I also comment out the
setupServer
inmocks/server.js
// setupServer(...handlers)
I expect the request to timeout and my error handling flow to be triggered
I would expect that not starting the server would suffice to revert to a non-mocked behaviour
thanks for your help
The text was updated successfully, but these errors were encountered: