Deploying on Google Cloud Platform : .forestadmin-schema.json file does not exist

Feature(s) impacted

Error when deploying production on Google App Engine

Observed behavior

I tried to deploy the backend on Google Cloud Platform following the tutorial found there :

The backend was unable to access the database (also hosted on Google Cloud Platform), so I followed the guide found there :

I am now stuck with the following error message when trying to deploy to production :

Waiting for your environment variables to be correctly set. If this error persists, please check your server logs.

When I check the server logs, I see the following message :

The .forestadmin-schema.json file does not exist.

When checking on the server, the file is, in fact, present.

Expected behavior

The deployment goes smoothly and I’m able to access my production app.

Failure Logs

2022-03-28 16:01:31 backoffice[20220328t161451]  Your application is listening on port 8081.
2022-03-28 16:01:31 backoffice[20220328t161451]  [forest] 🌳🌳🌳  The .forestadmin-schema.json file does not exist.
2022-03-28 16:01:31 backoffice[20220328t161451]  [forest] 🌳🌳🌳  The schema cannot be synchronized with Forest Admin servers.

Context

  • Project name: flooz-backoffice
  • Team name: Flooz
  • Environment name: production
  • Agent type & version: forest-express-sequelize-8.5.3
  • Recent changes made on your end if any: see description above

My app.yaml file :

runtime: nodejs16

service: backoffice

env_variables:
    FOREST_ENV_SECRET: '...'
    FOREST_AUTH_SECRET: '...'
    NODE_ENV: 'production'
    APPLICATION_URL: 'https://MYAPP.appspot.com'
    DATABASE_URL: 'postgres://USER:PASSWORD@IP/DBNAME'
    DATABASE_USER: 'USER'
    DATABASE_PASSWORD: 'PASSWORD'
    DATABASE_NAME: 'DBNAME'
    DATABASE_GCLOUD: 'DB_IDENTIFIER'

Hey @Sebastien, and welcome to our community :wave:

Could you please share your Liana.init call?
Also, could you precise if you are in an in-app (ForestAdmin living inside your project) or in a microservice (project generated with forest-cli) architecture.

Depending on the answer, I would suggest to try the schemaDir option, that allow you to specify the exact folder containing your .forestadmin-schema.json.

Hi @jeffladiray, thanks for your quick reply

I didn’t change the Liana.init call :

module.exports = async function forestadmin(app) {
  app.use(await Liana.init({
    configDir: path.join(__dirname, '../forest'),
    envSecret: process.env.FOREST_ENV_SECRET,
    authSecret: process.env.FOREST_AUTH_SECRET,
    schemaDir: process.env.FOREST_SCHEMA_DIR,
    objectMapping,
    connections,
  }));

  console.log(chalk.cyan('Your admin panel is available here: https://app.forestadmin.com/projects'));
};

Also, It’s a separate project that I initiated with the CLI following the tutorial

Could you eventually try specifying the value of FOREST_SCHEMA_DIR?

So I tried to set FOREST_SCHEMA_DIR to ‘/’ at first, it didn’t work
I then created a folder I called schema at the root of my project, copied the .forestadmin-schema.json in it, and set that as the FOREST_SCHEMA_DIR, and it worked.

Thanks for your help !

Is there a way to ensure that the schema is generated in this folder next time I start the dev environment ? Or do I have to copy it each time ?

Good to know it works :slight_smile:

I would suggest to either precise FOREST_SCHEMA_DIR in your development .env as well as on your production environment. You should be able to achieve your expected result doing so.

Thanks again for your help !

1 Like