`forest environments` returns `Error: Not Found`

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.

Feature(s) impacted

forest-cli

Observed behavior

forest environments returns error:

Expected behavior

forest environments returns list of environments

Failure Logs

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 ~/.nvm/versions/node/v14.20.0/lib/node_modules/forest-cli/node_modules/superagent/lib/node/index.js:1100:20
    at IncomingMessage.<anonymous> (~/.nvm/versions/node/v14.20.0/lib/node_modules/forest-cli/node_modules/superagent/lib/node/parsers/json.js:22:7)

Context

  • Project name: scratchpay-payment-service
  • Team name: all
  • Environment name: ???
  • Agent type & version: …
  • Recent changes made on your end if any: N/A

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.

Hello @Brett_Belka,

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 ?

Best regards,

Dogan

Hi @dogan.ay!

Thanks for your reply.

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

  1. create a new environment based up on the production environment
  2. create a branch in the new environment
  3. push changes on the branch to a remote branch on the new environment
  4. 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

I would like to direct you to our documentation, it covers in detail the development workflow, the branches and even the deployment.

I hope this helps.

Best regards,

Dogan

@dogan.ay Thanks for the help! I’ll let you know if I have anymore questions.

Thanks again!

It was my pleasure ! :slight_smile:
I will mark this topic as solved, feel free to create another topic if needed.