Impossible to log in forestadmin

Hello guys !!

i have some problem on my admin

I can’t connect to the admin I have this error
On my server I have successfully launched the forest login command but nothing happens
My environment is development

Please include any relevant log snippets, if necessary.

Context

Please provide any relevant information about your setup.

  • Package Version:
  • Express Version:
  • Sequelize Version:
  • Database Dialect: Postgres
  • Database Version:
  • Project Name:

Hello @etokas ! Welcome to our community :tada: :confetti_ball:

Ok, let try to find what happen here.

In order to help you can you share the failing call from your network tab ?
Can you also share your Package Version ? (forest-express-sequelize ?) And your project name ?

Thanks in advance
Morgan.

Hello,
Thanks for reply
So my project is Gravite
bollow my screen for my network

and my dependency

"dependencies": {
    "body-parser": "1.19.0",
    "chalk": "~1.1.3",
    "cookie-parser": "1.4.4",
    "cors": "2.8.5",
    "debug": "~4.0.1",
    "dotenv": "~6.1.0",
    "express": "~4.17.1",
    "express-jwt": "6.0.0",
    "forest-express-sequelize": "^8.0.0",
    "morgan": "1.9.1",
    "require-all": "^3.0.0",
    "sequelize": "~5.15.1",
    "pg": "~8.2.2"
  }

Hey again,

Thanks for those information.

Are you sure that your backend is running ?

For the network tab can you select All and make another screenshot of the preview response if there is one.

Regards,
Morgan

Hello,

There are nothing in review and my server still running


My .env

APPLICATION_PORT=3310
FOREST_ENV_SECRET=---------
FOREST_AUTH_SECRET=--------
DATABASE_URL=postgres://---------
NODE_ENV=dev
APPLICATION_URL=http://localhost

I think you have a CORS issue, as we see the 2 request failling. Can you share the headers of the first authentication request (pre-flight) ?
image

Can you also share your CORS definition in the app.js file of your backend ?

Thanks in advance. :pray:

It might just be the APPLICATION_URL. Try to replace by the following for your environment variable.

APPLICATION_URL=http://localhost:3310

Hey,

Did you find a solution for your issue ?

hello,

Sorry but it’s not working
i try reinstallation but it’s still working

i’m correctly log with forest login
but when i do npm start i’m this


my .env

APPLICATION_PORT=3310
APPLICATION_URL=http://localhost:3310

CORS_ORIGINS=

DATABASE_URL=---
DATABASE_SCHEMA=public
DATABASE_SSL=false
# This should be removed in production environment.
DATABASE_REJECT_UNAUTHORIZED=false

FOREST_AUTH_SECRET=---
FOREST_ENV_SECRET=--

on my server

Hey @etokas,

Sorry to hear that…

Seeing those screen I suppose you use a VPS ? If it’s the case this can cause the issue since the server run remote.

However, you can install Forest Admin on a remote server in this case, you must:

  • Change --applicationHost to the URL of your remote server when you use the create the project with forest projects:create

Tell me if it helps ?

Regards,
Morgan

Hello, Again me
After try installation many times
it’s work in localhost but when i got in dashbord i’m somes error
bellow my screen
Thanks for your help


My .env

APPLICATION_PORT=3310
APPLICATION_URL=http://localhost:3310

CORS_ORIGINS=

DATABASE_URL=postgres://user:pass@localhost:5432/db
DATABASE_SCHEMA=public
DATABASE_SSL=false
# This should be removed in production environment.
DATABASE_REJECT_UNAUTHORIZED=false

FOREST_AUTH_SECRET=--
FOREST_ENV_SECRET=--

docker lunch command

docker run --rm --init --network host -it -v `pwd`:/usr/src/app -v ~/.forest.d:/usr/src/cli/.forest.d -e TOKEN_PATH="/usr/src/cli" forestadmin/toolbelt projects:create "Gravite" --databaseConnectionURL "postgres://user:pass@localhost:5432/db" --databaseSchema "public" --applicationHost "localhost" --applicationPort "3310"

Hello @etokas,

The error occured when you try to display the bug collection. The error is pretty clear, your backend is unable to connect to the database… As your using a docker container it is due to a wrong network setup.

If you run on linux: The --network host options from your launch command is supposed to to the trick if you’re on linux ?

If you run on mac or windows: Can you try to use the host host.docker.internal (instead of the localhost in your DATABASE_URL) ?

Moreover, I recommend you to read about network bridge that allows multiple docker connected to the same bridge network to communicate.

Here is a thread from stackoverflow with more explanation.

Kind regards,
Morgan