Connection refused: AH00957: HTTP: attempt to connect to 127.0.0.1:3000 (127.0.0.1) failed. Failed to make backend connection.

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Gone away
    • Priority: Critical - P2
    • None
    • Affects Version/s: None
    • Component/s: None
    • Environment:
      google cloud platform and bitnami
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      mongo save causes error. Insert doesn't. I want to use save

      My client javascript:

      xmlhttp.open("POST", "http://35.197.106.195");
      xmlhttp.setRequestHeader("Content-Type", "application/json;charset=UTF-8");
      xmlhttp.send(JSON.stringify(myData));

      "POST /HTTP/1.1" 502 380

      I'm running server app by executing: node app.js . where app.js has the following code:

      var port = 3000;
      app.post("/", (req, res) =>
      
      var buyer = new Buyer({
              email: buyerObj[0].email,
               .
               .
          }).save()
          .then(item => {
              console.log("saved to database")
              res.send("record has been saved");
          })
          .catch(err => {
              console.log("err = " + err);
              res.status(400).send("unable to save 
              to database" + err);
          });
        });
      
      which I changed to 
      
      var buyers = {
      email: buyerObj[0].email,
      .
      .
      };
      mycollections.insert(buyers);
      res.send("record saved");
      

      This took care of the 502 error. I also had to add:
      ?authSource=admin to the connection string to make insert work.

      I want to be able to use save() and not insert.

            Assignee:
            Daniel Aprahamian (Inactive)
            Reporter:
            larry scheib
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: