Failed to push branch: source and destination environments must have the same schema ERROR

Feature(s) impacted

Ability to push Layout changes to a remote environment

Observed behavior

I made significant layout changes and minor changes to the back end code, all of which are successfully running on my local environment.

When trying to push the forest branch associated with these changes, I always receive the following error: Failed to push branch: source and destination environments must have the same schema

The backend server for the target environment had the schema file and all changes pushed to it, and was rebooted with those changes. Both my local environment and the remote environment are running the exact same code, including the schema file. All of the backend code changes appear on the remote environment successfully.

Running forest shema:apply, forest schema:update, and forest environments:reset --environment=Test all resulted in no difference in this behavior. The error still appears when trying to push the branch.

Expected behavior

The layout changes on my local development environment be applied to the remote environment with a successful forest push

Failure Logs

The logs from my local system when trying to push the branch:

forest push
? Select the remote environment you want to push onto Test
? Push branch test-branch onto Test Yes
× Failed to push branch: source and destination environments must have the same schema

As a note, when the server was rebooted with the change to the code and schema file, I did see the “Sending schema file to Forest…” printout, implying that the schema is changed compared to before the reboot, and the server is therefore running the new schema.

Context

  • Project name: charitywater
  • Team names: Charity Water, Twitsthink, Partners (all 3 have layout changes)
  • Environment name: Test (this is the remote), development (this is the local environment)
  • Branch Name: test-branch
  • Agent type & version: forest-express-sequelize:8.4.8
  • Recent changes made on your end if any: minor model changes, numerous layout changes

Other Notes

I see other similar issues reported previously, and it looks like there may have been a bug in Forest Admin. In those threads, the user was asked for environment secrets, so I’m including those here as well.

My Development environment secret (last 5 characters): 05099
Test environment secret: db33a
Co-worker’s Development environment secret: be9d8

Note that my co-worker is also working on some model and layout changes, but his changes are only in his development environment at this time (he has not pushed the changes). But I’m including his secret here too just in case.

Hi @Amber_S,

Thank you for providing all these details.
I am having a look at your project to find where does your issue comes from.

Regards

At this time, all your environments have a different schema except Staging and Production.
After the message “Sending schema file to Forest…”, do you have the message “Schema file sent.”?

Note: Your “development” git branch must be up-to-date with your “Test” bit branch by merging or rebasing Test onto development to have the same schema.

Can you please restart both your development and your Test, so we will check how was the refresh?

Regards

Hello, thanks for the help. I have reset both environments and am still getting the same error message when I try forest push.

As a note, I have not messed with the development environment since I put the code from it onto the test environment, so I see no reason why they should not be the same.

Thank you.

Ok, nothing changed when you restart (14h09 and 14h16).
It means Forest already has the schema synchronized for both of your environments.
Your schemas are in sync between your server and forest, but they are different together.

The diff between the two schemas show this:

  • A field named “Subscriptions” is present on Development but not in Test
  • A field named “partner” has a different reference and a different relationship (“HasMany” vs “BelongsTo”)

The “Test” main branch and the “development” main branch must be synchronized, then restart.

Best regards

Alright so that did work, I re-synched the environments another time via github and that solved the issue! Thanks for the help!