最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - vue axios.post method is neither doing anything nor throwing an error - Stack Overflow

programmeradmin7浏览0评论

I have a vue frontend with a flask backend and in addition a c++ camera backend. All of this has been working before. Now I switched to another computer and I´m using a different camera backend and camera. Now I run into this strange problem: When I press a frontend button, It first triggers the camera image acquisition, waits for the filepath and THEN it should do an axios.post to my backend api. But nothing happens. The Endpoint doesn´t get triggered and I don´t get any errors or responses.

When I enter the debugger and trigger the whole axios.post statement manually, it works fine!

Any ideas what I can do?

  • Working on a Windows Machine
  • npm version 10.9.2
  • vue version 3.3.4 (i think)
  • axios version 1.7.9
  • Flask backend
async function startImgAnalysis() {
  updateBusy(true);

  recordStore.setRecordName(recordName.value);
  await recordStore.createSnapshot(recordName.value, recordType);

  await sleep(500); // we need a pause here, to make sure the image was really written 
  var path = await recordStore.getLatestRecord(recordName.value, recordType);

  if(!path){
    errorStore.setError("Analysis could not be started!", "The file path is empty.")
  } else{
      //debugger;
      console.log(path);   // this works!
      axios.post("analyze/start", {'path': path})   // nothing happens till I do it manually via debugger
          .then((res) => {
            let statuspath = res.headers.get('statusid');
            analysisInProgress.value=true;
            updateProgress(statuspath);
          })
          .catch((err) => {       //No errors are logged
            console.error(err);
            updateBusy(false);
          });
    }
}

Edit: I see the POST in my develepor tools and it looks like this: What does that tell me? There is no helpful information, no header or response info...

Edit: It starts feeling like an absolute joke... What I´ve tried so far without any difference: I will keep adding to this list...

  • using another browser (chrome & firefox)
  • using low security setting in browser
  • removing all cookies and cache
  • using privacy mode in browser
  • trying other versions of axios
  • adding everything (*) to Access-Control-Expose-Headers on my server side
  • adding routing to handle OPTIONS in the flask app.py @app.route('/analyze/start', methods=['OPTIONS'])
  • completely deactivating the firewall
  • starting the request via debugger (well that works without any issues but is not a solution for my problem)
  • using waitress instead of flask development server
  • using waitress with 2-8 threads
  • changing the post method into a get method
  • crying
  • adding json header and stringify (also querystring.stringify) to the request
  • using fetch instead of axios. Apparently, this is NOT an axios issue!
  • upgrading Flask
  • restarting the computer
发布评论

评论列表(0)

  1. 暂无评论