Forest environments:copy-layout is throwing an error

Expected behavior

Hey there folks,
Am expecting to run the command forest environments:copy-layout <from-project-id> <to-project-id> and for it to apply the layout on my local branch to the staging environment.

Actual behavior

At the moment I’m getting an error as follows:

What is the current behavior?

Failure Logs

Please include any relevant log snippets, if necessary.


Please provide any relevant information about your setup.

  • Package Version:
    forest-cli/2.0.1 darwin-x64 node-v12.20.2
  • Express Version: “^4.17.1”
    “forest-express-sequelize”: “^7.3.1”,
  • Database Dialect: Postgres
  • Project Name: Oak National Academy

Hi @Mitchell_Lloyd ,

Since you speak about branches, I understand you activated the Development Workflow (V2).
Copy-layout are V1 command, it is unnecessary to use them in V2.

You can use forest push or deploy to apply your development layout to the staging.
(use ‘deploy’ if staging is the reference, which means you do not have production yet. If you have a production, use ‘push’)

HI there @Sliman_Medini,
Thankyou for your help. The reason why we tried to use this command is because we tried using forest push to push our local branch changes to the staging environment and we got this error:

Error: Failed to push branch: source and destination environments must have the same schema

Hey @Mitchell_Lloyd,

You won’t be able to solve this issue by doing a copy environment. The Copy environment is just abou the layout not about the schema. The ionly thing you have to do is to make sure both your environments are on the same version/commit :wink:

Thankyou @vince,
I think I have misunderstood something then - I thought the schema file was used to create the layout. So you’re saying that the schemafile must be exactly the same in 2 different environments in order to update one environment with a branch ?

Yes the 2 environments needs to have the same schema when you push your branch. This just mean that you must push your code on git or whatever you use before pushing on forest :wink:

Ah thankyou that makes sense now ! Cheers @vince