question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

POST firing twice, no OPTIONS

See original GitHub issue

Summary

Im using Axios and react for my front-end client and after long time of debugging i found out that something is triggering my Spring RestController method, always twice, always about two minutes in (it’s very long response with huge amount of data)

Network tab does not show this second POST, but when ran from Postman, everything works as expected (no random double calls)

` showCurrent = (dateA, dateB) => {

console.log("whaaaaat")

axios.post("api/allData", {

    params: {

        date_a: dateA,

        date_b: dateB

    }})

    //successful fetch

    .then(res => this.setState({

        Data: res.data,

        isLoading: false,

        showPage: true,

        home: false,

    }))

    .catch(function (error) {

        //handle errors here

        alert(error.message);

    })

};`

This will print “whaaat” only once, despite below axios request happening twice.

Context

  • axios version: v0.18.0
  • Environment: Ubuntu / windows 8
  • Browsers: Firefox

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6

github_iconTop GitHub Comments

3reactions
balumurirajcommented, Jul 12, 2019

My Bad. Found the issue. “Node.js has a default timeout on all incoming requests, and if you don’t change the timeout, then Node.js will kill the TCP connection if you don’t respond to the client in that amount of time.” - https://github.com/expressjs/express/issues/2512

Worked fine after fixing my request timeout in node.js

2reactions
balumurirajcommented, Jul 23, 2019

@jkonze - I don’t have the access to close the issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

POST Request Firing Twice When Pressing Button After Page ...
When pressing the button which sends a POST request, the request is fired twice but only after the page is freshly reloaded.
Read more >
Post Registration Hook is firing twice - Auth0 Community
For some reason, as of a couple of days ago, our post registration hook seems to be firing twice, sending duplicate user info...
Read more >
BUG: Email Triggers firing twice - Forum - VisualCron
Since the last update, we have noticed that jobs triggered by emails are activating twice. The email trigger is set to move the...
Read more >
publish_post hook trigger twice when I publish post
I am trying to send email post content on post publish and written small function in functions.php but it fires twice I am...
Read more >
LWC Wire Service - Firing Twice - Salesforce Stack Exchange
The second time it fires is immediately after it receives data (or generates an error). In other words, response in your code will...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found