Forestadmin-schema.json not updating in development

My forest_liana deployment in dev works great and I’ve started modifying the UI. But when I tried to run it in my staging environment, deploy got me the error :

* 2021-06-24T17:38:55+02:00 [2021-06-24 15:38:55] Forest 🌳🌳🌳 The content of .forestadmin-schema.json file is not a correct JSON.
* 2021-06-24T17:38:55+02:00 [2021-06-24 15:38:55] Forest 🌳🌳🌳 The schema cannot be synchronized with Forest Admin servers.

I realized that none of my UI changes, even after a server restart, had an impact on the schema.json file.

Expected behavior

forestadmin-schema.json changes after app restart

Actual behavior

Nothing changes and staging deploy fails

Context

"meta": {
    "liana": "forest-rails",
    "liana_version": "6.6.2",
    "stack": {
      "database_type": "postgresql",
      "orm_version": "5.2.6"
    }
  }

Thanks !

Hello @albandum,

You are only allowed to update your .forestadmin-schema.json in a development environment.
Is it your case?

Thank you,

Yes I’m in my dev environment when trying to update

Hello @albandum,

Did you test the content of your .forestadmin-schema.json into an online validator like https://jsonformatter.curiousconcept.com/ ?

Do you see anything incorrect in your generated file?

Yes, looks like it’s not valid indeed !

Error: Parse error on line 4005:
...			"default_value": "<h1>%{platform_name
-----------------------^
Expecting 'STRING', 'NUMBER', 'NULL', 'TRUE', 'FALSE', '{', '[', got 'undefined'

One of my fields has a default value with variables embedded and looks like it breaks :


{
			"field": "email_end_submission",
			"type": "String",
			"default_value": "<h1>%{platform_name} will close in %{days_before_end} day(s) !</h1>

			Your submission is still in progress.

			You can now edit and finalize the application form,
			using this link:

				%
				{
					update_link
				}

			Do not forget to finalize the application when you are done.

			Cheers,
			The Team ",
			"enums": null,
			"integration": null,

It’s defined this way in my schema.rb :

t.text "email_end_submission", default: "<h1>%{platform_name} will close in %{days_before_end} day(s) !</h1>\n\nYour submission is still in progress.\n\nYou can now edit and finalize the application form, using this link:\n\n %{update_link}\n\nDo not forget to finalize the application when you are done.\n\nCheers,\nThe Team"

Thank you @albandum,

Json files do not support multi lines, that’s why you get the error.
But you should also get this error on development environment. Is this default value different between environment?

Can you tell me how you defined the default value for the email_end_submission field?
Is it a field from a smart action?

Let me know :slight_smile:

No, it’s a regular field from rails, directly defined from a migration I believe. It’s basically just a db field with a default value !
So it looks like your json builder isn’t escaping the newline characters ?

So I removed that from the default db value and am now setting the default value elsewhere. Deleted the forestadmin-schema.json, and it seems to work now.
But that might be something to look at on your side.
Thanks !

1 Like

Thank you @albandum,

I’m glad it helped!
We will look after this issue.