I’m trying to develop my first feature with this new cli workflow. When I try to forest branch, I get Environment cannot be found. When I try using forest environments to check which environment I’m on and get a list of environments, I get an error.
I played around with this cli tool a bit when we migrated and the forest environments command worked at that point. I didn’t actually create a branch but the all of the commands seemed to work at that point. Now most commands return Environment cannot be found and forest environments behaves as described.
forest environments returns error:
forest environments returns list of environments
Error: Not Found
at PromiseRequest.Request.callback (~/.nvm/versions/node/v14.20.0/lib/node_modules/forest-cli/node_modules/superagent/lib/node/index.js:857:15)
at IncomingMessage.<anonymous> (~/.nvm/versions/node/v14.20.0/lib/node_modules/forest-cli/node_modules/superagent/lib/node/parsers/json.js:22:7)
This isn’t a solution but I found a workaround - I went into the UI and created a new environment, then launched my local backend to allow the new environment setup to finish. Now forest environments returns a list of our environments.
Why can we still create a new environment in the UI if we’re supposed to use the cli? Also, we still have to edit the layout in the UI and the backend via our normal git workflow. What purpose does the cli serve? I’m having trouble determining it’s utility.
Sorry to hear that you have some issues with the toolbelt.
I have checked the logs of our server to see if I could get more details on what happened and I see no errors related to your project or environments. Are you on the latest version of the toolbelt ? Have you made any changes on your environment variables between the time you received an error and the list of environments linked to your project ?
I didn’t make any changes to .env variables between when I got a list of environments and when I got an error.
I did change the FOREST_ENV_SECRET and FOREST_AUTH_SECRET before I got the list again but those were changed bcecause I created a new environment, so I needed those values for the new environment.
When I created the new environment, I did notice that my dev environment, which had been there before, wasn’t there anymore so maybe I deleted it inadvertently in my playing around with the cli commands…? This was the environmnet that I was working in previously so maybe I deleted it and that caused a problem?
However, even if that’s the case, it doesn’t seem like I should be unable to get a list of environments.
As a related question, do I have to change those ENV variables every time I want to change environments?
I am also still kind of struggling to wrap my head around how environments relate to branches. It’s my understanding that you can only make branches on local environments. So, to take my production code and develop a new feature, I’d have to
create a new environment based up on the production environment
create a branch in the new environment
push changes on the branch to a remote branch on the new environment
deploy changes in the new environment
The piece that I still seem to be missing is merging the branch into the main branch of the environment. If I branch within an environment, what do I do to get the changes on the branch to merge into the main branch of the environment so that I can depoly the changes on the new environment to production?
I think this is most certainly it, before executing any command we authenticate the user to authorise the execution of the command, to do so we use the FOREST_ENV_SECRET to find the project linked to the environment in question. The environment had been deleted as such, no project was found. I agree that we could improve the error messages on our toolbelt, I will add this to our backlog so that we can work on it at some point in time.
You should be using the toolbelt from the folder of your different environments. The toolbelt will fetch the variables in your .env