0
votes

I am getting the error my-endpoint.amazonaws.com sent an invalid response. ERR_INVALID_HTTP_RESPONSE when I try to connect to the amazonaws which hosts my MySQL database. I know my credentials are fine and it is actually connecting to the database because the following code console.logs properly:

const db = mysql.createConnection({
    host: 'my-endpoint.amazonaws.com',
    port: 3306,
    user: xxxx,
    password: xxxx,
    database: 'mirayna'
})

db.connect((err) => {
    if(err){
        throw err;
    }
    console.log('Database connected')
})

But when I make a call from my application in any way I get the error, examples:

<form action="my-endpoint.amazonaws.com:3306/post" method="post" 
              className="form">
          <button type="submit"></button>
</form>

or

  const getSentences = () => {
    Axios.get("my-endpoint.amazonaws.com:3306/post",
      {
        search: unclusteredSearch
      }
    ).then(response => {
      console.log(response)
    }).catch(e => {
      console.log(e);
    });
  }

with

app.post("/post", (req, res) => {
  console.log("Response!");
}