Can't install FA on remote server

Yep, again me, don’t shoot ! i’m sorry but i need you again ^^"

Expected behavior

Deploy on a remote server

Actual behavior

When i try to install FA on my remote server, i can’t access my datas

Failure Logs

None

Context

Please provide any relevant information about your setup.

  • Package Version:lastest
  • Express Version:lastest
  • Sequelize Version:lastest
  • Database Dialect:mariaDB
  • Database Version:lastest
  • Project Name:admin_vhc

I’ve followed this guide : https://docs.forestadmin.com/documentation/how-tos/setup/install-forest-admin-on-a-remote-machine

I have a server on debian 9 with Plesk installed. Node JS extension is also installed, but when i try to make an NPM start, i get stuck with this message :

FA

Even after 10 min, nothing change…

Hello @j.cange, welcome back,

As stated on the documentation, it is not the right way to deploy your app on a remote server :slight_smile:

From the previous message, I guess you already have a development installation working. In order to deploy your code to a remote server, You just need to go to your project settings, under the environment tabs. Then you should be able to deploy from here, by just updating your environment variables.

(You can find some doc on how to deploy on a ubuntu server here)

1 Like

I already did the deploy from my development installation by editing the environment variables. And that didn’t work :frowning:

I’ll try your solution from the ubuntu server documentation buuuuuuuuut i don’t really know if that will work on debian :confused:

Hello @j.cange :wave:

What’s the error you observed when you tried to deploy to production please ?

Thanks in advance :raised_hands:

Steve.

1 Like

Hi @Steve_Bunlon

Well, sadly, i didn’t get any error… When i started the server (with npm start) the console returned that everything was ok, but when accessing the domain name or the app.forestadmin, it said that my server was unreachable

This is the default deployment process (It’s very easy to do), and it should work for both debian & ubuntu (Since you are just deploying a nodejs process, and eventually hosting a database).

As stated @Steve_Bunlon, maybe you had an error in chrome console/network tabs to share (The process you mentioned should work, even if that’s not the encouraged way to deploy).

Just let us know if you re-encounter the issue using the deploy process you choose initially, or the “classic” way to deploy

Oooookay so, i’ve tried the git solution to deploy on my plesk server. Here is the result that my domain name show when i’m on his web page with node js launched :

/var/www/vhosts/vivactishealthcare.com/admin.vivactishealthcare.com/node_modules/express-jwt/lib/index.js:20
if (!options || !options.secret) throw new Error(‘secret should be set’);
^

Error: secret should be set
at module.exports (/var/www/vhosts/vivactishealthcare.com/admin.vivactishealthcare.com/node_modules/express-jwt/lib/index.js:20:42)
at Object. (/var/www/vhosts/vivactishealthcare.com/admin.vivactishealthcare.com/app.js:36:9)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Module.require (internal/modules/cjs/loader.js:681:19)
at Module.require (/usr/share/passenger/helper-scripts/node-loader.js:80:25)
at require (internal/modules/cjs/helpers.js:16:16)
at loadApplication (/usr/share/passenger/helper-scripts/node-loader.js:243:2)
at setupEnvironment (/usr/share/passenger/helper-scripts/node-loader.js:214:2)
at Object. (/usr/share/passenger/helper-scripts/node-loader.js:133:1)
at Module._compile (internal/modules/cjs/loader.js:774:30)
at Object.Module._extensions…js (internal/modules/cjs/loader.js:785:10)
at Module.load (internal/modules/cjs/loader.js:641:32)
at Function.Module._load (internal/modules/cjs/loader.js:556:12)
at Function.Module.runMain (internal/modules/cjs/loader.js:837:10)
at internal/main/run_main_module.js:17:11

Also, i have this error on the env configuration page (when FA send the new secret key etc) :

Access to XMLHttpRequest at ‘https://admin.vivactishealthcare.com/forest’ from origin ‘https://app.forestadmin.com’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

Could you please check the environment variables associated to your production project ?

The error could be related to a missing FOREST_AUTH_SECRET.

Also, I would suggest you to try removing the node_modules folder & re-run & yarn install, just in case that would help.

Hi !

So, the FOREST_AUTH_SECRET is correctly set, i’ve deleted and re-run a NPM install, the same error occur again…

Is it possible that Plesk block something? I’ve opened the port 3310 just in case, but nothing change.

Hi @j.cange !
By looking at the Plesk documentation, I saw that you can set the environments variables can be set like that. Could you try it ?

Hi @Nicolas_Sailly :slight_smile:

I’ve added the environment variables as a custom variable for node right in plesk, but it still doesn’t work…

If i try to access my domain name, it return me that the panel is available on https://app.forestadmin.com/projects but there is nothing except my local dev environment :frowning:

Btw i still get this error :

Access to XMLHttpRequest at ‘https://admin.vivactishealthcare.com/forest/sessions’ from origin ‘https://app.forestadmin.com’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

You can try to follow this post: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource
Tell me if it works !

Edited the CORS_ORIGIN in my .env and i also added it to my node custom variables but still nothing :frowning:

You still get the same error ? :thinking:
Maybe the problem comes from Plesk: https://support.plesk.com/hc/en-us/articles/115001338265-How-to-set-up-CORS-cross-origin-resource-sharing-in-Plesk-

Okay, i’ve followed your link and this end up with a new error :

Access to XMLHttpRequest at ‘https://admin.vivactishealthcare.com/forest/sessions’ from origin ‘https://app.forestadmin.com’ has been blocked by CORS policy: Response to preflight request doesn’t pass access control check: The value of the ‘Access-Control-Allow-Credentials’ header in the response is ‘’ which must be ‘true’ when the request’s credentials mode is ‘include’. The credentials mode of requests initiated by the XMLHttpRequest is controlled by the withCredentials attribute.

And a little bit lower on my console :

Access to XMLHttpRequest at ‘https://admin.vivactishealthcare.com/forest/healthcheck’ from origin ‘https://app.forestadmin.com’ has been blocked by CORS policy: No ‘Access-Control-Allow-Origin’ header is present on the requested resource.

I’d say rollback the latest changes then, I’m not really familiar with Plesk, are you sure you set the right CORS_ORIGIN ? Did you edit anything in your project ?

Based on the topic you sent me (Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource) i’ve set the CORS_ORIGIN to https://app.forestadmin.com

Also, i didn’t edit anything except the .env as asked on the deploy page

I think the problem comes from your Plesk configuration then, setting up the CORS_ORIGIN variable should be enough for FA to work. Maybe look into your nginx conf if you use one as a reverse proxy.

Looks like yes, i have an nginx with reverse proxy. It was installed by default with Plesk

I think the problem might be here :sweat_smile: