Hello! I have created a new model on my project and tested on Developments. (im working on my forest branch new-schema). Now when i run forest deploy to view this new model on the production panel i have the error:
ISSUE: source and destination environments must have the same schema
From what I’ve been seeing I think I may need to do a push but I haven’t found the right documentation to explain how to achieve my goal. What would be the step by step guide I should do to upload these changes to production?
These changes are the creation of a new model and the addition of some fields to the existing models.
Thank you!
Hey @usr1vang,
Could you share here your project name so I can compare your schema in both your environment ?
Usually, this error indicates that the schema (.forestadmin-schema.json
) running in production & in your development environment is not the same. Could you also make sure that’s the case ?
Thanks in advance
My project name is yala. Yes, there are different because i modify my schemas on development. Now i want to push this changes to production but im not sure how to do it.
The new schema should be deployed to your production first (with your code).
Once your production server restarted with the new schema, it will be send to our servers and they will be the same. Then, you should be able to apply the changes your made on the UI from development to production via forest deploy
.
Im working with heroku. I have already update and restart my server but still having the same issue at the moment of forest deploy.
@user1vang,
I’ve just compared your .forestadmin-schema.json
and they are still different. Unless this is fixed on your end, forest deploy
will throw this error. Both of your .forestadmin-schema.json
must strictly be the same in order for the command to work.
When running your server with NODE_ENV=development
, your server will regenerate this file.
When running your server with NODE_ENV=production
, your server will use the existing schema and send it to our server.
I can privately share the difference I can see on the compared schema, but you should also be able to download the schema from your production server and compare it with the one you have on development.
You can also use forest schema:apply
to ensure that both file are totally in sync on your environment.
I was able to do it! I was having trouble regenerating the .forestadmin-schema.json file.
Thank you very much for your time and help!
Sorry to come back with this post, but every time I make layout changes in the Development environment I have problems when I want to deploy it to the Production environment. Always the same error that source and destination are different, I have managed to solve it by trying many things but I can not understand what would be the methodology to follow.
My way of proceeding is, I make changes in the layout of the development environment as well as in the code. Then I deploy it to my heroku server, and then I apply forest schema:apply and forest deploy to upload those changes to production, but I always get the error I mentioned.
What am I doing wrong or what step am I skipping?
The “classic” flow should be:
- You work on your development. On each restart,
.forestadmin-schema.json
is regenerated
- Once your dev is done, you push your code (With the
.forestadmin-schema.json
) on your VCS
- When you deploy your code (On any remote, either staging or production), your server will restart and use the versionned
.forestadmin-schema.json
, which is sent to our servers
- Using this flow, both your dev & production share the same schema, allowing you to use command like push or deploy
Let me know if that answer your question
Ok, I understand, but that is exactly the steps I have followed and I am still having the same problem. I have pushed my changes to my server and restarted it. Then I try to deploy the forest and I get that error about the source and destination.
According to the data I can see in our backoffice, your development & production schema are not the same. I can share the differences privately if that helps.
However, production & staging shares the same schema.
Yes, I agree that they are different that’s why I get the error, but I don’t understand how this can happen if I updated my server with the local changes (.forestadmin-schema.json included) and also ran forest schema:apply. What would I have to do to get the same schema? I think I’m doing something wrong, maybe when I update the server but I can’t figure it out.
forest schema:apply
shouldn’t be necessary in a development/manual deployment context.
Usually, restarting the production server with the correct .forestadmin-schema.json
should be enough.
To unlock the situation, you could either:
- commit & push to production the
.forestadmin-schema.json
you have on development
- reset every changes and make sure that both development and production exactly share the same schema
-
forest schema:apply
your development schema on your remote environment