I don’t really have an idea why but my .forestadmin-schema.json isn’t getting updated anymore automatically…
So now, I have to updated it manually each time I add a smart action or a smart field… Do you have any idea in which direction I should investigate to? I have no error in the output or anywhere else…
I am quite sure you can’t access the code of the project but I am open to share the code if you need to.
Hi @Emixam23 !
You should never update the schema manually as it should be re-generated every time you launch your server.
Do you have any error log when you start your server ?
Sorry for the late response…
I know right, it should be automatic but as of today, it’s not anymore so I do it manually each time I need to update it…
I have absolutely no log(s) about it… However, if it’s missing (like if I remove the file), it throw an error as schema couldn’t be found
I don’t really know how I can provide to you information but I am open to share the code with you if required (with a dataset of course)
Could you pin the version of forest-express-{mongoose|sequelize} you are using? (Even forest-express if it is still in your package.json?). It would be easier to investigate this issue, since a few contributions happened this year on the schema generation.
Now, regarding the architecture, I don’t know if chaging the language of the files from JS to TS means “chaging the architecture” to you but that the only things that comes up to me as of today
Also, I don’t have at all this environment variable set → FOREST_DISABLE_AUTO_SCHEMA_APPLY
Thanks again I will try to be more reactive next time
I am not sure to get you… I am actually editing the layout (as well as the .forestadmin-schema.json) in the “local (dev)” environment and when I need to, I copy the “layout configuration” to the other projects env using your system in the top banner (that emails me once OK)
I hope I could answer as expected to your interrogation
Hi @Emixam23, I have some questions.
Sorry for the first ones, Do you restart your server when you change something to regenerate the schema?
How do you start your server?
I have maybe an idea to debug this.
It seems that there are a silent error, I think due to your model definition.
What I suggest is to try to:
FOREST_DISABLE_AUTO_SCHEMA_APPLY=true put this env variable on your .env file. this variable will prevent, for the next step, the synchronization of your schema on our server.
2 . Try to remove / comment your models one by one and restart your server until the .forestadmin-schema.json re-generates again.
I hope it’s help, let me know if my suggestion help you find the model involved.
I commented out all my schemas and models (kept only interfaces to do not have to comment out the whole project)
I removed the .forestadmin-schema.json file
I start the server with FOREST_DISABLE_AUTO_SCHEMA_APPLY=true
I start the server with FOREST_DISABLE_AUTO_SCHEMA_APPLY=false
logs on start(no matter if FOREST_DISABLE_AUTO_SCHEMA_APPLY is true or false)
[nodemon] 2.0.7
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): dist\**\*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `node ./dist/server.js`
Your application is listening on port 3310.
[forest] ��� The .forestadmin-schema.json file does not exist.
[forest] ��� The schema cannot be synchronized with Forest Admin servers.
Your admin panel is available here: https://app.forestadmin.com/projects
Let’s try something
Could you create a new project on Forest Admin with the exact same database and look a what the last version of lumber generated for you.
Tell me if you see any big differences between the models regeneration. Maybe we could have a clue there.
See if the .forestadmin-schema.json is well generated.
[forest] ��� The .forestadmin-schema.json file does not exist.
[forest] ��� The schema cannot be synchronized with Forest Admin servers.
I wonder if you don’t have an environment variable misconfiguration in your development environment.
Can you check the value of your NODE_ENV?
Unless the value is "dev" or "development", your local server will behave as a “production” admin backend and will never try to introspect your models and generate the .forestadmin-schema.json.
It will sent the .forestadmin-schema.json as versioned.
As stated by @arnaud, the .forestadmin-schema.json will only be regenerated if NODE_ENV is dev or development so yes, it worth giving this a shot, and it will definitely allow you to regenerate the forestadmin-schema when modifying your models.
The other values for NODE_ENV to be used on remote environment should be displayed on the deploy-to-remote/production flow and are mandatory for everything to work as expected.