Waiting for your backend to run

Expected behavior

Forest Admin installation to finish and dashboard to appear

Actual behavior

Installation process is blocked on “Waiting for your backend to run”

Context

I have installed Forest Admin using npm.

When i launch npm start on my server, in the Bocoloco directory, I got the following output :

bocoloco@0.0.1 start /root/Bocoloco
node ./server.js

Your application is listening on port 3310.
Your admin panel is available here: https://app.forestadmin.com/projects

But when I go to the webpage https://app.forestadmin.com/projects

I got the following error :

Your admin backend is unreachable. Please check that it is running and respond to http://localhost:3310.

BUT: If I go to my server IP address and reach the port 3310, I got a message saying “your application is running”

On the other side, on the installation web page I got the following info:

Waiting for your backend to run

  • Package Version:
    npm : 6.14.4
    node : v12.16.3
  • Database Dialect: mysql
  • Database Version: mariadb Ver 15.1 Distrib 10.1.37-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
  • Project Name: Bocoloco

Could you please give me a hand on this one ?

1 Like

Hi @Florent ! :wave:

What error do you get in the chrome dev console ?
You have no error on the liana end ?

Hi Nicolas,

When I try to reach : https://app.forestadmin.com/projects, I am redirected to a page where i need to choose my projet, then I choose Bocoloco and I got a prompt saying “Unlock your data” which is asking for my password.
I use the same as the one use to connect to Forest Admin (Ok with that ?), when I click on enter, the dev console is showing 3 errors regarding Cross Origin Request blocked,
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:3310/forest/sessions. (Reason: CORS request did not succeed)

Could you please advise what is Liana ?

Regards

Yes it is the same password.

It seems to be a CORS error :thinking: can you try to add these domains in the .env file ?

Liana is the name we give to lumber generated projects :slight_smile:

Ok I have tryied to go to the link mentionned in the post but it hosted in Gitbook and password protected : https://app.gitbook.com/login/forestadmin/how-to-s?location=%2Fgeneral%2Fconfiguring-the-cors-headers

I have tried to access it through my usual forest admin credential, and also my personnal github account but without success

I have also been checking in the main Forest Admin documentation and there is no info :
https://docs.forestadmin.com/documentation/?q=CORS

Could you send me the page or the credential needed?

After searching the web, I have tried to add :
http://app.forestadmin.com/ and https://app.forestadmin.com/ in the .env CORS_ORIGINS variable.

I also used console.log to check that the variable “allowedOrigins” was used well and was integrating the .env modification. Everything seems good :

[
  /\.forestadmin\.com$/,
  'http://app.forestadmin.com',
  'https://app.forestadmin.com'
]

BUT still not working.

Another info :
If I use Firefox, I got the error mentionned above.

But If I use Chrome, i got the following error:

“Failed to load resource: net::ERR_CONNECTION_REFUSED”

Small question :
1 - Is it normal that the URL mentionned in the CORS error is “localhost” based ?
http://localhost:3310/forest/sessions.
The same url is mentionned in the orange popup in the right bottom corner when i try to log in, saying:

Your admin backend is unreachable. Please check that it is running and respond to http://localhost:3310.

My point :
Is there some configuration issue from your side regarding the IP used for my Bocoloco project ?
Shouldn’t it be based on the IP address of my Bocoloco server like http://XX.XX.XX.XX:3310 ?

2 - I can connect to port 3310 of the server IP using my personal browser, and I get a webpage saying “Application is running”.
Shoudn’t it mean that the CORS is enabled ?

I have tried to delete Bocoloco project and create a new one with the same parameters,
Same issue is happening : “Waiting for your backend to run” at the end of the installation process.

When I check the dev console, I got the same error repeating :

Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at http://localhost:3310/forest. (Reason: CORS request did not succeed)

even though the application is up and running when I check the IP address of my server on port 3310.
It’s still strange that the IP address used is again localhost based.

Hi @Florent,

I think I guess why you are facing this issue.

:point_right: When creating a development environment, host have to be explicitly localhost and be accessible via http. This is the only host Forest Admin allows without having to set :lock: https , for security reasons; in a regular process, your development environment have to be local and accessible through localhost. Then, after this local environment works, you would be able to create other environments (prodution, staging, etc.). But still they will require to be accessible through :lock: https only.

Could you consider trying to install your backend on localhost first? :house:

Hi Raphael,

Thanks for this response.
Could you be more precise about how to do that in the installation process ?

If you want to setup a development environment on localhost (e.g start a new project with Forest Admin), you have to follow the onboarding steps that are described here. Running the lumber generate… command (last step) on your local computer will generate an application that will be accessible locally for you, through http://localhost:3310 (side note: your database is not required to run locally, it’s just about your backend server).

Then, your backend application should be accessible in Forest Admin UI, you can start using it :tada: . When it works, you are ready to configure staging and production environments. Let me know if you are facing issues during this process!

Hi Raphael,

Good advise, thanks !!
I succeeded configuring my “Bocoloco Dev” project and I now have access to my local environment !
I strongly suggest to add it to your tutorial installation guide :),

To install to production, should I remove everything I have done on my remote server or should I let it like this ?

1 Like

I’m glad it works locally! :confetti_ball:

To install to production, should I remove everything I have done on my remote server or should I let it like this ?

You could keep what you have done; however, I suggest you start a fresh install on production following these steps when you are ready.

Thanks Raphael.

I am doing a fresh install and following the installation step.
I am now a bit confused, in the host input, shoud I put the IP of my server or still localhost ?

Regards

The host in the screen below is your database host. You are free to use the host you want: it can be local or remote database. Still, it have to be accessible to your local machine, since your backend will need access to it.

You could have a look at the generate command in the next step: it contains an application-host and a database url (connection-url).

lumber generate "my-project" \
  --connection-url "postgres://foo:bar@my.database.host.com:5432/baz" \ 
  --ssl "false" \
  --schema "public" \
  --application-host "localhost" \ 
  --application-port "3310" \ 
  --email "rap2h@example.org" \
  --token "xxx"

In this case it’s my.database.host.com and localhost

Hi Raphael,

I did follow your instruction, everything seems OK concerning the install.
BUT, now I have … the “waiting for your backend to respond” message :smiley: !

After checking, it seems that It could come from a certificate issue :

  • my remote server is having a valid certificate,
  • If I try to access the port 3310 throught https, a got a “secure connection failed”
  • If I try to access the port 3310 throught http, I got the “application is running” message

Do you have any clue ?

Another info : I have a webpage running on that server

If your root server http://localhost:3310 (without any path) respond with:

Your application is running!

Then everything should be OK (see screenshot below)

Could you:

  • Refresh the Forest Admin UI page (the one with: "waiting for your backend to respond" message)
  • Check your logs (from your backend and Forest Admin UI in browser)

Another info : I have a webpage running on that server

I don’t get it. Could you tell me more? Maybe it’s an important info!

I am realizing that I did not give you all the info : I am now trying to make the production environment work.

So I have click on the “deploy on production” header on my dev environment.

I have created a git for my local environment, then I have followed all the steps, everything has been working so far.

To have more info on the context :

  • I have a remote production server with a DB in a specific IP, on OVH.
  • I have a domain name for this production server as it is also hosting a website, which is using data of the DB

To come back to the “deploy to poduction process” :

  • For the URL, I have specified the domain name associated with my production server.
  • For the host, I have specified the IP address of my production server
  • For the port, I have specified the 3310.

Then I followed all the installation steps, and I got again stuck on the “waiting for your backend to run”.

I add again the previous test steps I have been doing :

  • my remote server is having a valid certificate
  • If I try to access the port 3310 of my production server throught https, a got a “secure connection failed”
  • If I try to access the port 3310 of my production server throught http, I got the “application is running” message, but it’s in HTTP and not HTTPS.

I am wondering if I should not modify the server.js of the express server ?

Hi,

Do you have any clues ?
I have succeeded following the stackoverflow post and now I have my server responding on port 3310.
But I have again a CORS issue with the domain name referenced in the installation process .
The error I have now in my chrome console :
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://server_domain_name/forest. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match “my domain name”’).

Regards

Hi @Florent,

Spent some time reading this long topic, so just to be sure: you run, on the same domain name, your website and your admin panel ? So the complete URL of your admin panel with https looks like https://yourdomainname.something:3310 ?

There should be, in your lumber project, a .env containing a CORS_ORIGINS= variable. Maybe you could give this a try ?

Hi Jeff,

Concerning the domain name :
Before installing forest admin, I already had a website on my production server attached to a domain name.
My production server is linked to a DB which is the one that I want to monitor using forest admin.

First,
I have installed a dev environment (local) of Forest Admin that is monitoring the local DB I have on my local environment.
Everything is now working on dev environment, meaning that I can access my forest admin panel for the dev using the project name “Bocoloco Dev”
Now I am trying to make it work on the production environment (remote production server)

I have followed all instructions as said in my previous post.
My first issue was with the certificate, meaning that If I tried to access https://www.domain_name.something:3310 I got the security error, but the same URL with HTTP was working.

Now I have succeeded in making the httpS://www.domain_name.something:3310 working, meaning that I do have a webpage with the logo of forest admin saying : your app is running.

BUT, the installation process is blocked at the last step “setting your environment variable” with the message saying : "it looks like the URL is not responding "
And If I open the console, I get the error I have mentionned before
Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://server_domain_name/forest. (Reason: CORS header ‘Access-Control-Allow-Origin’ does not match “my domain name”).

Thanks for the recap. Did you try to add the CORS_ORIGINS variable ?

Yes,
I tried to add my domain name, and the www.bocoloco.fr website,
even though I don’t really understand where the domain name “www.bocoloco.fr” is coming from, I did not share it ?

I have tried to add it to the .env file, and then in the app.js

I still have the same issue