Unable to complete set up of staging environment

Description

So I have already got my production environment running fine on GCP’s App Engine, but I wanted to try migrating to Cloud Run as it offers better CI/CD support for secrets.
I have successfully deployed my staging branch to Cloud Run - I get the “Your application is running!” message back from the URL, and I’m logging out the ENV and AUTH secrets to ensure they have been set correctly.

The FA console is polling /forest on my API and getting a 204 in response, but I guess it doesn’t like something about the response because it’s still stuck on “Waiting for your environment variables…”

Maybe if you could advise what the Forest Admin console is expecting to see in that response I could work out what is wrong…?

Many Thanks

Feature(s) impacted

Environment deployment / deploy a remote environment via the Forest Admin console.

Observed behavior

I have deployed my staging branch to Cloud Run and set the environment variables as directed, however the Forest Admin UI still displays the message “Waiting for your environment variables to be correctly set…

Expected behavior

I would expect to be able to set up my new environment successfully, assuming I had followed all the required steps correctly.

Context

  • Project name: UX-Catalyst-2
  • Team name: Operations
  • Environment name: Staging

Hi @Shane_Parker and welcome in our community :champagne: :smile: !

So if I summarise you tried to create a remote environment using the deploy a remote environment, correct ?
If your application is running, accessible from your browser then maybe you have a firewall on your new staging server. The staging server must be able to call the forest admin server or it won’t works. If that’s the case you should have error logs on your server. Is that the case ?

Hi Vince, thanks for coming back - in answer to your queries:

  1. I used the button “Add a new environment” in the project settings to create the environment, but I actually deployed the api it via a github action (which I assume is not relevant?).
    I am not familiar with the “deploy a remote environment” feature you mention though… is this what I should actually be using?

  2. I have no error logs on my API server, just the record of the FA console making the call to /forest while it checks for the correct environment variables.
    If there was a firewall issue I would not be seeing the 204 come back for this request in the FA console… would I?

Thanks,

Shane

When you start your server, it should be doing a call to POST https://api.forestadmin.com/forest/apimaps. If you have a firewall it might block this call. And without that call your environment can’t work as we don’t know it’s schema.
Do you have any .forestadmin-schema.json in your staging build ? If not that could also be the issue :thinking:

Aha! Thanks to your help I have now managed to fix this issue! I did in fact have an error in the logs, but at server start up (when it attempts to make that POST request you mention).

The error message was “The .forestadmin-schema.json file does not exist” - despite it being present in the deployed code bundle.

To fix this I referred to another post in the forum here that advises the following:

In your Dockerfile, after “ENV NODE_PATH=...” add:

ENV FOREST_SCHEMA_DIR=/usr/src/app

And then in middlewares/forestadmin.js after “authSecret: process.env...”:

schemaDir: process.env.FOREST_SCHEMA_DIR,

And my staging environment is up and running - many thanks!