Problem with forest push and schema:apply

Feature(s) impacted

Not able to push local changes to QA or PRODUCTION environment

Observed behavior

If I run command forest push, next error is returned

× Failed to push branch: Source and destination environments must have the same schema. Please check your environments code is synchronized.

If I run schema:apply command with environment secret value, next error is returned

Cannot properly read the “.forestadmin-schema.json” file: “orm_version” is required

Expected behavior

Changed should be available after push or even schema apply instead of error messages


Please provide in this mandatory section, the relevant information about your configuration:

  • Project name: Buffl.1
  • Team name:
  • Environment name: QA

Meta secrion from forestadmin-schema.json

  "meta": {
    "liana": "forest-express-mongoose",
    "liana_version": "8.6.6",
    "stack": {
      "database_type": "MongoDB",
      "engine": "nodejs",
      "engine_version": "16.11.0",
      "orm_version": "5.8.4"

Hi @Irfan_Krijestorac,

About error #1 - Source and destination environments must have the same schema:

Running the push command will send the layout changes from your source environment (local development environment) to the destination environment.
To do this, it is required that both source and destination have the same (forestadmin) schema.
To be sure the same schemas are on source and destination, it’s needed to have both git branches entirely synchronized (git pull/push).
Sometimes it is not the case because someone else added commits to the destination.

As I can see, all of your 5 environments have different hashes, meaning they all have different schemas.


Hi @Sliman_Medini thanks for you answer. If I compare two branches I see no difference between my develop branch (in sync with local branch) and qa branch that is used for Forest Admin QA environment.


Is this tool comparing in both directions? Maybe looking on the diff tab, or using git diff branch1..branch2 is safer to compare.

Also, to have schema synchronized on the forest side, in addition to git synchronization, it is needed to restart the servers in order to have them synchronized with forest.

I see differences in the agent version, 8.6.6 vs 8.6.5

Comparing branches in both directions showed no difference.

Checking Environment tab in Forest Admin Project Settings I see as well that Liana Version is different for Development and QA. Already tried to restart QA server few times but no changes. That is a known issue for us, and we almost always had to execute schema:apply to force .forestadmin-schema.json file to be updated. But in this specific case, schema:apply is also failing and we are not able to apply changes.

Here is the list of your environment with their last synchro dates.
Hope it will help you to find what synchronization is missing.

dev “irfan” => last synchro yesterday at 18h (today synchros changed nothing)
dev “joche” (outdated agent version) => last synchro 20th May at 14h (later synchros changed nothing)
Prod => last synchro 16 May at 11h
QA => last synchro 06 May at 13h

The same version is needed, and be able to synchronize all your environments.
Restarting QA has an effect only when its code is updated.

Other things to take care of are:

  • Using fixed versions in your package.json
  • Using yarn.lock OR package-lock.json depending you are using yarn or npm, it is important to use only one of them.
  • Put the lock file inside git

Hi @Sliman_Medini ,

Could you please verify what is the latest sync time for forestadmin-schema.json file for QA environment?

Now, when I check Environment tab in Forest Admin Project Settings I see the same Liana versions for my Development and QA, but still forest push shows error message. forestadmin-schema.json file on QA environment should be the same as one on my Development environment.

Failed to push branch: Source and destination environments must have the same schema. Please check your environments code is synchronized.

Hey @Irfan_Krijestorac,
Your latest sync was at 24/05/2022 15:22:38 for your QA environment.

Please can you provide your forestadmin-schema.json ?

Hi Alban, here is the meta section of .forestadmin-schema.json file that you requested.

  "meta": {
    "liana": "forest-express-mongoose",
    "liana_version": "8.6.6",
    "stack": {
      "database_type": "MongoDB",
      "engine": "nodejs",
      "engine_version": "16.11.0",
      "orm_version": "5.8.4"

A little trick to know what fields are different is to do a JSON diff between your generated schema from your 2 environments. You can use this tool:
Do you have any diff with this tool ?

@Alban_Bertolini comparing two .json files I see this as a difference.

Although two environments have same code deployed, for some reason this field is missing on the QA environment. Is there a possibility that server modifies this .json file and remove it for some reason?


Now I managed to have two files to be identical, I still have the same push error

I have compared your dev (updated 27/05/2022 10:33:34) and the QA (updated 24/05/2022 15:22:38) schema file and they are always different because on your QA env you don’t have isPrimaryKey attribute.
Please go to same git branch of your QA and restart your server to regenerate your schema on your development environment.

Hi Alban,

I don’t know how you got that difference, but no diff result is what I got comparing local file and file from QA server.

What I see is a different timestamp I see for my forestadmin-schema.json file and timestamp you mention here.

Do you have always the issue ?

Hi Alban,

Yes issue is reproducible on both remote environments we have, QA and PROD.

We didn’t have issue with schema:apply before migration to new system with branches etc. Now schema:apply is not working because of the orm_version is required.

Hey @Irfan_Krijestorac :wave:

The thread contains a lot of messages, so I’ll sum it up just to be sure I fully understand the issue.

You frequently encounter the × Failed to push branch: Source and destination environments must have the same schema. Please check your environments code is synchronized.

Running forest schema:apply triggers another error: Cannot properly read the “.forestadmin-schema.json” file: “orm_version” is required.

Running forest schema:apply is not recommanded in the development workflow context, and should only be used in a few use-case.

As stated from @Alban_Bertolini, the last .forestadmin-schema.json received on our end on the QA environment is from the 05/24 and is different from your development environment, which either means that:

  • The .forestadmin-schema.json on the QA server did not change since the 05/24?
  • Even if the file changed, your server was not restarted?

On our end, we do not have any log for your QA (nor Production) environment indicating a failure on saving this schema.

In order to solve this, could you confirm that:

  • Both your QA and Production have the NODE_ENV=production variable set (Especially useful as this prevent the server to re-generate the .forestadmin-schema.json and force the server to use the one versioned in the repository)
  • That all your dev either don’t have NODE_ENV=production set, or that the NODE_ENV variable is equal to anything else than production

The last resort manupilation to fix this kind of issue would be:

  • On your development environment, drop .forestadmin-schema.json, and restart your server
  • A new one should be generated. Handle your versionning as you usually do
  • Once done, deploy the new code on your QA server
  • In development, run forest schema:apply, and force-apply this schema on your QA
  • At that point, both schema should be the same and push should work as excepted.

Once everything is correct, forest deploy to should be available and work as expected.


× Failed to push branch: Source and destination environments must have the same schema. Please check your environments code is synchronized.

is related to the schema already available in forest. If this error is raised but both of your schema are the same locally, this could indicate another issue (Failure to send the schema, falsy network settings, etc), and these kind of issues should be visible in your backend logs.

Let me know if that helps :pray: