score:1
Why does axios post method stop working after 6 consecutive post calls?
It is probably because your original code was not sending any response back to the client. A browser has limits on how many requests it will allow in progress to the same host. Once it hits that limit, it queues the request and waits until one of the previous requests finishes before sending the queued request.
So, once you added res.send(...)
to your POST handler (for both success and error conditions), then the browser didn't hit its simultaneous requests limit to the same host and you could send more requests just fine.
score:1
I am an idiot. For some reason I had left the try and catch block out of the post method in the router. That is why it wasn't giving any response from the router!
I have no idea why the database updates 6 times successfully without a try/catch block. But adding in the try catch and response allows it to update endlessly.
(see updated router post method with try and catch below)
router.post('/pageupdate/:_id',auth, async(req,res)=>{
console.log("received request to update: ",req.body," id ",req.params);
const filter = { "_id": req.params };
const update = [{ $set: req.body }];
try{
let updatedDoc = await Pages.findOneAndUpdate(filter, update, {returnNewDocument: true});
res.status(201).send(updatedDoc)
}
catch(e){
console.log(e);
res.status(400).send(e)
}
});
Source: stackoverflow.com
Related Query
- Why does axios post method stop working after 6 consecutive post calls?
- How to Stop component to refresh after axios post in react. After uploading image from formData
- Why does mocked axios get method return undefined?
- I don't understand why my axios post request isn't working - 404 not found
- Why does Hot Module Replacement stop working on webpack dev server when I setup Babel es2015 preset?
- React.JS - ComponentDidUpdate Method Does Gives Infinite Loop for Axios Calls
- Axios Post method authorization does not work - React
- Reactjs => axios post method ERROR not working
- Why does my Auth.currentAuthenticatedUser() method return updated state after I reload and not when the useEffect's dependency runs (or login/logout)?
- I'm Requesting POST Method via axios but post method is not working
- Why does my axios call return undefined even after then is resolved?
- Why does ASP.NET Core 6 MVC Route handler not accept data from axios post request?
- Why does preventDefault stop working when I try to use a function passed by props?
- Why does calling react setState method not mutate the state immediately?
- In React ES6, why does the input field lose focus after typing a character?
- Why does React warn me against binding a component method to the object?
- Making redirects after an axios post request with express
- Why does a redux-saga use put method instead of dispatch?
- why axios send OPTIONS request method not DELETE or PUT method
- React Native + Redux: Why does Switch immediately turns back to false after being switched to true?
- Why does chrome dev tools console show a link for Post 500 error in one website but not another?
- Why does React throw an error when setState method used in a class constructor?
- Axios POST request not working
- Slideshow transitions stop working after the first slide
- Why do Material UI tabs stop working when I use a .map to populate the content dynamically instead of hard coding?
- React.js: Will multiple async setState method calls always re-render after and impact performance?
- why does asp.net core 3.0 reactjs app only come up after refreshing browser?
- Why does React Hooks Axios API call return twice?
- Why axios appends the current URL to API calls in Laravel / React?
- does React apply its reconciliation algorithm on consecutive calls to ReactDOM.render?
More Query from same tag
- Property 'previous' is missing in type - TypeScript + ReactJS
- How to display data correctly from an API?
- Nested function call in onClick not firing
- How to update the props of a rendered react component from App.js?
- next js getInitialProps error Cannot read property 'map' of undefined
- How to pass ref to draw control in react-map-gl
- How to trigger the onChange event in React after user stops typing for a specified time
- How to get content of Redux store in console without devtools?
- Displaying Index column in mui-datatables
- CSRF Protection with Flask/WTForms and React
- Export import in reactjs
- rendering string as html in dropdown menu
- Authorized header rejected in dockerized spring application
- How to click on a ReactJS wrapping element?
- Phone number not getting retained in react-phone-input-2
- component in react js not rendering
- How do I close the current browser tab on ReactJS?
- React - refractor state in a component
- How can I submit my textbox value to go to a a link in React js?
- React 'props' is not defined
- Is there a way to get "this.lastID" from sqlite.run() callback using es6 and react classes
- Redirect to a custom URL after login in NEXT-AUTH
- How to use playbackRate parameter for video element in ReactJS?
- Cannot read property 'map' of undefined at new ZoomIndicator
- react-native : Unable to resolve module `tty` from ''.../node_modules/window-size/index.js": Module does not exist in the module map
- I have an error with my jsconfig.json in react js says throw err Unexpected token } in JSON at position
- Welcome page/ first launch page using react/next.js
- material ui: find which component create this tag
- React Creating Dynamic Select and Option Elements with Material-UI
- Why do react elements outside of Route re-render?