New development environment stuck in draft!

Feature(s) impacted

I’m trying to create a new development environment using forest init. I completed the forest init flow and update the .env in my admin backend repo with the provided APPLICATION_PORT (default value used i.e. 3310), the new FOREST_AUTH_SECRET and the new FOREST_ENV_SECRET.

Now I can run my admin backend repo using yarn start-dev and it runs perfectly fine as excepted, the issue is that this new development environment is still stuck in the draft state when viewing it on: https://app.forestadmin.com/Emma/settings/environments

Can’t quite figure out how to move it out of the draft state so that I can create my branch and set this environment as its origin.

If I try to create a branch right away after the forest init flow, I get the following:

forest branch cashback-support --origin "Development | sahilmemon"
× Cannot set "Development | sahilmemon" as self origin.

Also, just to add to the above:

Based on the init docs:

It says that I need to run my admin backend locally prior to running forest init which doesn’t make sense since when I run my admin backend that way using yarn start-dev, it start the admin backend server but using the FOREST_AUTH_SECRET and the FOREST_ENV_SECRET that were already set in the repo’s .env file (by the project creator) and then I can’t run forest init and get the following error upon doing so:

forest init
× Selecting your project
× User not authorized to perform this action

If I just comment out the FOREST_AUTH_SECRET and the FOREST_ENV_SECRET from the .env file then I can’t run the admin backend via yarn start-dev and I get the following error (but I can then run forest init to create a development environment, which gets stuck in the draft state):

/Users/sahilmemon/Emma/backend/nodejs/node_modules/express-jwt/lib/index.js:20
  if (!options || !options.secret) throw new Error('secret should be set');
                                         ^


Error: secret should be set
    at module.exports (/Users/sahilmemon/Emma/backend/nodejs/node_modules/express-jwt/lib/index.js:20:42)
    at <anonymous> (/Users/sahilmemon/Emma/backend/nodejs/packages/forest-admin-backend/app.js:47:3)
    at Object.<anonymous> (/Users/sahilmemon/Emma/backend/nodejs/packages/forest-admin-backend/app.js:75:18)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Object.j (/Users/sahilmemon/Emma/backend/nodejs/packages/forest-admin-backend/node_modules/tsx/dist/cjs/index.cjs:1:1197)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at <anonymous> (/Users/sahilmemon/Emma/backend/nodejs/packages/forest-admin-backend/server.js:10:15)

Node.js v20.11.0

I’d appreciate some help, the docs seem to be a bit misleading so please let me know if I’m missing any steps. Thanks.

Observed behavior

Upon completing the forest init flow, the development environment is stuck in a draft state preventing me from creating a branch and setting this new development environment as its origin.

Expected behavior

Upon completing the forest init flow, the development environment should not be created in the draft state and I should be able to create a branch with this new development environment as its origin.

Context

  • Project name: Emma
  • Team name: Rewards
  • Environment name: Development | sahilmemon
  • Agent technology: Node.js
  • Agent (forest package) name & version: forest-cli@5.0.9, forest-express-sequelize@9.0.0
  • Database type: MySQL
  • Recent changes made on your end if any: Updated a model and schema in the codebase.

Hi @sahilm1806 and welcome to our community :slight_smile:

In order to launch your agent with the new environment, please replace your agent with the FOREST_ENV_SECRET with the one in your project settings for this environment and restart the agent.

Best regards,

Shohan

Hi @shohanr,

Thanks for the quick reply. I’ve already done that and I’m able to start the admin backend locally:

But the environment is still stuck in draft:

Thanks,
Sahil

Hello sahilm,
“Draft” status is when your forestadmin-schema.json is not sent to forestadmin. The schema is sent when you start your server and when there is a change. We have never receive your schema :confused: . Can you try to add a customization locally to fake a change and restart you server please ? :pray:

Can you check in your server log if there is something like this:

Your application is listening on port 3000.
[forest] :deciduous_tree::deciduous_tree::deciduous_tree: Checking need for apimap update…
[forest] :deciduous_tree::deciduous_tree::deciduous_tree: Sending schema file to Forest…

Best regard,
Alban

Hi @Alban_Bertolini,

I had this set in my .env:
FOREST_DISABLE_AUTO_SCHEMA_APPLY=true

Changed it to false and the schema was sent, no longer is the environment in draft. Thanks for your help! :tada:

Regards,
Sahil

1 Like

:partying_face: :tada: Awesome!
Have a nice week

1 Like