Cannot deploy to UI to production
When I try to run forest deploy, I get the following error:
➜ ForestAdmin git:(dev)$ forest push
? Push branch development onto Production Yes
× Failed to push branch: Cannot "push" to reference environment, please use "deploy"
➜ ForestAdmin git:(dev)$ forest deploy
? Deploy layout changes to reference? Yes
× Source and destination environments must have the same schema. Please check your environments code is synchronized.
➜ ForestAdmin git:(dev)$ forest branch
NAME ORIGIN IS CURRENT CLOSED AT
production Production 2022-07-22T15:30:58.461Z
development Production ✅ 2023-01-09T14:17:19.284Z
I’m expecting to be able to deploy/push my layout changes to production.
- Project name: PayAtt Internal Admin Portal
- Team name: IT
- Environment name: Development
I have verified that the .forestadmin-schema.json is identical in development and production using https://jsondiff.com/
Both environments have the same git hash and I’ve tried running
forest schema:apply and it says:
The schema is the same as before, nothing changed.
I’ve also tried to find differences between the environments in the portal, but they seem identical to me (same liana version). Both environments say that they have sent the schema file.
What could be going wrong here?
From what I can see you have removed the declaration of your hook in your smart actions. I count 11 changes.
I have made quite some updates and I’m not able to find the hook you are referring to (although I have no errors when running the server). Could you write the collection and hook name that was removed?
Is there any way for me to find the changes between the forest schema files that have been sent to you, in order to debug this from my side? (In git the the schemas are the same on both dev and prod)
Sure thing ! The hooks were removed from the definition of the field for the following actions :
- bootstrap-new-customer / “onDefaultPermissionChange”
- disable-entire-merchant / “onDeleteChange”
- create-test-user / “validatePassword”
- create-test-user / “generatePassword”
- create-user / “validatePassword”
- create-user / “generatePassword”
- duplicate-user / “validatePassword”
- duplicate-user / “generatePassword”
- send-sms / “onRecipientChange”
- send-sms-all-customers / “onRecipientChange”
- add-phone-numbers / “onCSVUpload”
To update the schema locally before applying it, you would need to restart the agent. Keep in mind that if your ‘NODE_ENV’ variable is set to “production”, the schema won’t be updated.
Thanks for the list, though I am a little confused. This looks like all hooks in the repository, and they are all present in the code and in my local schema (as far as I can tell). I haven’t made any changes to them.
I tried updating the name of the “validatePassword” and “generatePassword” hooks to “onValidatePassword” and “onGeneratePassword”. Then restarted the server to create a new schema.
The console says the schema file was sent on both dev and prod. Dev has NODE_ENV=development.
Still the same result. How can I fix this?
I managed to solve it! What I did:
- Set the
FOREST_ENV_SECRET to that of production
- Switched back to the dev value for
I’m not sure if this is good practice, but at least it solved the schema mismatch for now. Thank you for the help!