Unable to deploy my layout changes

Hi

I did some changes in my schema, then uploaded it using my CI. On the other hand I did some changes in my layout (in the my Development environment, on the “leads” branch) and when I tried to forest deploy my changes I had the following message: × Source and destination environments must have the same schema. Please check your environments code is synchronized. .

I went to see the Layout on my Production env, and there is a missing Smart Relationship on my Agency collection: hasMany_Lead_originAgency .

Everything works fine on my Development env though.

Feature(s) impacted

Please describe in this mandatory section the feature(s) that will be discussed in this topic.

Deploying layout changes

Observed behavior

Please describe in this mandatory section the current behavior you observe.

Unable to deploy my layout changes

Expected behavior

Please describe in this mandatory section the behavior you are expecting.

I should be able to deploy my changes because both schemas are identical.

Context

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

  • Project name: Pinpo Admin
  • Team name: Operations
  • Environment name: Production
  • Agent type & version: “forest-express-mongoose”: “8.6.7”
  • Recent changes made on your end if any: updated and deploying a new schema using my CI

Hello :slight_smile:
You should synchronise your code in the production environment. Dev and Prod must have the same code. Your smart relationship is not displayed because your code is not up to date.

Hi @Alban_Bertolini, that’s what I just told you, I did release my changes. So I don’t know why it’s not visible.

Your schema in development and in production looks different. I have compared the production and the development schema and there are some differences.

For example:

So what should I do? I can assure you that both codes are identical, since I am on master, no changes, and my branch is deployed.

Should I delete and rebuild my schema from scratch?

Ok.
Please can you restart your dev and your production ?
Also, can you send your agent version in dev and in production ?

I did both and nothing changed.

Agent version in dev and production: forest-express-mongoose 8.6.7

Hey @fbeiger :wave:

I just looked at your project and something looks off.

Your .forestadmin-schema.json should be re-generated only in a development environment. According to your project configuration, the received apimap on your other environment are just a bit different (as @Alban_Bertolini spotted, the enums: null).

The fact that your .forestadmin-schema.json in development does not contains the enums: null is weird though.

Both remote and production environment should not re-generate the schema (By setting NODE_ENV=production on these environment, to make sure the schema is read only, not changed).

I would suggest:

  • To checkout all changes locally, and restart your development backend (And make sure NODE_ENV=dev, or anything different than production)
  • Make sure the locally generated schema contains these enums: null
  • Make sure that both remote & production environment have NODE_ENV=production, just so they do not touch your generated schema.
  • Let your CI do all the heavy lifting on schema synchronisation (It seems to be the case in what I can read).

(Let me know if these steps are unclear!)

As a side note, we also provide via forest-cli a command that can force sync your schema when you encounter this type of error (forest schema:apply). I allow to post a local .forestadmin-schema.json to another environment. It shouldn’t be needed in your case, but … can allow you to unlock specific situations where you have the × Source and destination environments must have the same schema. Please check your environments code is synchronized. (So use it wisely)

Let me know if that helps

1 Like

Hi @jeffladiray

Thanks for your long and comprehensive answer.

First of all, I did the 4 steps you mentioned above, and despite that, it did not change anything. So I had to manually force the schema using the forest-cli. At the end it works fine.

Now that all my environments are synced, it should not be an issue anymore, and I think I will be able to deploy normally.

Thanks again for your help.

1 Like

I can now see that your development environment embed the enums: null values that were initially causing issues, which is definitely a good start!

Please keep in mind that the forest schema:apply definitely helps when having this kind of issue, however, our development workflow is designed to handle .forestadmin-schema.json changes, thus shouldn’t be a requirement to make everything works as intended - And I’m still unsure what caused your issue in the first place.

(I’ll wait for you to confirm that you were able to deploy normally, and mark the thread as resolved once it’s done :+1:)