What is causing this Heroku mysql connection error? (Trying to connect frontend to backend POST request)

{Solved}. New Bug

Error from Heroku logs:

Error: connect ECONNREFUSED 127.0.0.1:3306
2021-09-23T18:24:12.236657+00:00 app[web.1]: at TCPConnectWrap.afterConnect.          [as        oncomplete] (node:net:1146:16) {
2021-09-23T18:24:12.236658+00:00 app[web.1]: errno: -111,
2021-09-23T18:24:12.236658+00:00 app[web.1]: code: 'ECONNREFUSED',
2021-09-23T18:24:12.236658+00:00 app[web.1]: syscall: 'connect',
2021-09-23T18:24:12.236659+00:00 app[web.1]: address: '127.0.0.1',
2021-09-23T18:24:12.236659+00:00 app[web.1]: port: 3306,
2021-09-23T18:24:12.236659+00:00 app[web.1]: fatal: true

Information / Background:

React js front end (hosted now on Netlifty) Javascript Node backend using Express and MYSQL2 (Hosted on Heroku)

Goal: To connect Neflifty Frontend POST request with Heroku Backend fetching POST payload data and inserting it into MYSQL table.

Update: 09/24/2021

I have done all that was suggested. I have created a new database with clearDB. Added it and tested the connection in mysql Workbench. Created the table needed. Updated the backend code for creating the connection to the new database. Checked heroko variables and made sure they reflected correctly to the new database. Now there is an authorization issue.

New Backend Code with corrections:

{removed}

Question: If this connects locally on workbench why wouldn't Heroku connect if they are added as variables?

Any help on this would be greatly appreciated.



from Recent Questions - Stack Overflow https://ift.tt/3ENFYS3
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Spring Elasticsearch Operations

Network Error and Timeout on Authorize.net JS

Object oriented programming concepts (OOPs)