"Your server encountered an error" trying to access Forest Admin for the first time

Expected behavior

After logging in, should be able to access data within the application.

Actual behavior

Failure Logs

[forest] Unexpected error: getaddrinfo ENOTFOUND mysql mysql:3306
SequelizeHostNotFoundError: getaddrinfo ENOTFOUND mysql mysql:3306

Context

This setup is an evaluation, running locally in Docker.

Hi @LauraB :wave:

First thing first, welcome to our community!

To help you out with your issue, I’ll need to reproduce it on my side.
Could you please tell me:

  • Did you install a Forest project with lumber? May you tell me the name of this project?
  • Did you get a chance to access to your data at some point or it never worked?
  • What do you mean exactly by “this setup is an evaluation, running locally in Docker”?
  • The failure logs that you sent were given on the server generated by lumber?

Thanks :slightly_smiling_face:

  1. Yes, I installed with lumber. Project name is Skipper Test 3.
  2. I have not been able to access the data at all. The tables are there in the left column, but the error occurs when I try to view any actual data. Note that I used the exact same installation process to create a second project using your demo database, and that project works fine. It’s only the mySQL project that is failing. I have confirmed that I can connect to the mySQL database from another Docker container and view the data.
  3. By evaluation, I mean that I am evaluating Forest to see if it will meet our needs, so I’m running mySQL and the local server in Docker, and I can wipe them out and start over as needed to help diagnose the problem.
  4. Yes, the failure log entries are coming from my local server that was generated by lumber.

Hi @LauraB,

Thank you for your answer :pray:. Could you double check your connection URL in your .env file (in your lumber project); it should look like this:

DATABASE_URL=mysql://user:password@localhost:3306/mydatabase
DATABASE_SSL=false

Unless you have a very specific installation, DATABASE_SSL should be false. Also, you have to verify that the database URL string contains your actual host, port, user, password and database name. You could also try to replace the hostname with the actual IP (e.g: localhost vs 127.0.0.1)

If everything seems good to you, you could try to create a minimal project :point_down: to check if it’s a problem related to Lumber or if it’s a problem about MySQL connection with node in your dev environment.

Minimal test with mysql

Create a small project from your command line:

mkdir test-mysql
cd test-mysql
npm init -y
npm install --save sequelize
npm install --save mysql2

Then create a index.js file with the following content (source):

const Sequelize = require('sequelize');
const sequelize = new Sequelize('mysql://user:password@localhost:3306/mydatabase');

sequelize.authenticate()
  .then(() => {
    console.log('Connection has been established successfully.');
  })
  .catch(err => {
    console.error('Unable to connect to the database:', err);
  });

Run it:

node index.js

It should display:

Connection has been established successfully

1 Like