Can't finish deployment on Heroku

This is a template you can use to report issues. You can also drag images, videos and include Preformatted text

Expected behavior

Get a “Finish” when deploying to production.

Actual behavior

“Waiting for your environment variables to be correctly set. If this error persists, please check your server logs.” stays there forever

Failure Logs

Here the logs from Heroku:

2021-08-13T22:11:58.660075+00:00 app[api]: Set FOREST_AUTH_SECRET config vars by user admin@getsmarto.com
2021-08-13T22:11:58.660075+00:00 app[api]: Release v19 created by user admin@getsmarto.com
2021-08-13T22:11:59.899244+00:00 heroku[web.1]: Restarting
2021-08-13T22:11:59.964303+00:00 heroku[web.1]: State changed from up to starting
2021-08-13T22:12:01.012307+00:00 heroku[web.1]: Stopping all processes with SIGTERM
2021-08-13T22:12:01.523868+00:00 heroku[web.1]: Process exited with status 143
2021-08-13T22:12:03.494937+00:00 heroku[web.1]: Starting process with command `npm start`
2021-08-13T22:12:06.536155+00:00 app[web.1]:
2021-08-13T22:12:06.536186+00:00 app[web.1]: > smarto-forestadmin@0.0.1 start /app
2021-08-13T22:12:06.536188+00:00 app[web.1]: > node ./server.js
2021-08-13T22:12:06.536188+00:00 app[web.1]:
2021-08-13T22:12:07.836256+00:00 heroku[web.1]: State changed from starting to up
2021-08-13T22:12:07.757738+00:00 app[web.1]: Your application is listening on port xxxxx.
2021-08-13T22:12:07.788862+00:00 app[web.1]: [forest] 🌳🌳🌳  The .forestadmin-schema.json file does not exist.
2021-08-13T22:12:07.788865+00:00 app[web.1]: {}
2021-08-13T22:12:07.789560+00:00 app[web.1]: [forest] 🌳🌳🌳  The schema cannot be synchronized with Forest Admin servers.
2021-08-13T22:12:07.789560+00:00 app[web.1]: {}
2021-08-13T22:12:07.879011+00:00 app[web.1]: Your admin panel is available here: https://app.forestadmin.com/projects
2021-08-13T22:12:08.410496+00:00 heroku[router]: at=info method=OPTIONS path="/forest" host=smarto-forestadmin.herokuapp.com request_id=xxxx fwd="xxxxxx" dyno=web.1 connect=0ms service=7ms status=204 bytes=406 protocol=https
2021-08-13T22:12:08.448234+00:00 heroku[router]: at=info method=GET path="/forest" host=smarto-forestadmin.herokuapp.com request_id=xxxx fwd="xx.xxx.xxx.xx" dyno=web.1 connect=0ms service=12ms status=204 bytes=218 protocol=https
2021-08-13T22:12:08.417104+00:00 app[web.1]: OPTIONS /forest 204 0 - 2.167 ms
2021-08-13T22:12:08.453636+00:00 app[web.1]: GET /forest 204 - - 11.096 ms
2021-08-13T22:12:09.665408+00:00 heroku[router]: at=info method=GET path="/forest" host=smarto-forestadmin.herokuapp.com request_id=xxxx fwd="xxx" dyno=web.1 connect=0ms service=9ms status=204 bytes=218 protocol=https
2021-08-13T22:12:09.667294+00:00 app[web.1]: GET /forest 204 - - 7.179 ms

Context

I use Docker and Heroku.

I set up all required env vars in Heroku. Doesn’t help. I restart the Heroku app manually. Doesn’t help. I tried deleting and recreating Forestadmin projects. Doesn’t help. I tried using another browser for finishing the deployment. Doesn’t help.

Also, https://smarto-forestadmin.herokuapp.com/ shows a blank page.

  • Database Dialect: Postgres
  • Project Name: smarto-forestadmin

Hi @Zigfrid, and welcome to our community :wave:

The fact that you are getting a blank page is a bug on our end. I’ve just open a PR to fix it, but on your end, the file views/index.html is missing a closing </title>. That should fix your second issue.

In your logs, I can see you are missing the .forestadmin-schema.json - is this file commited/available in the code you are deploying on Heroku? (This file is mandatory for the deploy to production flow to work as expected).

Let me know :pray:

1 Like

Hi @jeffladiray, thank you for your answer!
I fixed the frontend issue but how am I supposed to generate .forestadmin-schema.json? It doesn’t exists in my local repo.

Good to know for the first point :+1:

Following a “classic” way of on-boarding, you should have your generated backend running on your local machine. Could you confirm if it’s working?

If that’s the case, you should have a generated .forestadmin-schema.json at the root of your project folder, containing infos about your models, actions, …
This file needs to be versionned in your VSS, and deployed in Heroku with your code.

To be more explicit on how it works:

  • On development, we generate and update this file on each server start-up.
  • On production, the generation step is skipped, and your server will use the one already generated in development.

Hope this helps.

Using Docker installation, I get this:

docker run --rm --init -it -v `pwd`:/usr/src/app -v ~/.forest.d:/usr/src/cli/.forest.d -e TOKEN_PATH="/usr/src/cli" forestadmin/toolbelt projects:create "smarto-forestadmin" --databaseConnectionURL "xxx" --databaseSchema "public" --applicationHost "localhost" --applicationPort "3310"
√ Connecting to your database
√ Analyzing the database
√ Disconnecting from your database
√ Creating your project on Forest Admin
  create config/databases.js
  create forest/table1.js
  create forest/table2.js
  create forest/table3.js
  create forest/table4.js
  create forest/table5.js
  create forest/table6.js
  create forest/table7.js
  create forest/table8.js
  create middlewares/forestadmin.js
  create middlewares/welcome.js
  create models/index.js
  create models/table1.js
  create models/table2.js
  create models/table3.js
  create models/table4.js
  create models/table5.js
  create models/table6.js
  create models/table7.js
  create models/table8.js
  create public/favicon.png
  create routes/table1.js
  create routes/table2.js
  create routes/table3.js
  create routes/table4.js
  create routes/table5.js
  create routes/table6.js
  create routes/table7.js
  create routes/table8.js
  create views/index.html
  create .dockerignore
  create .env
  create .gitignore
  create app.js
  create docker-compose.yml
  create Dockerfile
  create package.json
  create server.js
√ Creating your project files
√ Hooray, installation success!

So there’s no .forestadmin-schema.json :worried:

The generated backend is running correctly locally.

Theses are the logs for the generation step - Your .forestadmin-schema.json is not generated here, but on server start-up.

Also, are you generating a new project for your production environment?
If you have a backend running on your local machine, you shouldn’t have to create a new one for your production.

Could you share with me your project name, so I can check on my end the configuration of your project?

Thanks in advance?

Sure!

  • Project Name: smarto-forestadmin

I followed the usual steps: run a couple of docker commands, then deploy the generated code to Heroku and set all the environment variables. I’m not generating a new project for my production environment.

Thank you!

1 Like

:+1:

Please note that this file is hidden (starting with a .), so it can definitely cause issue, especially in a docker setup. If everything is running as expected locally, then you have a .forestadmin-schema.json somewhere.

On my end, I can see that your Local environment is configured correctly.
However, I can’t see your production URL. Could you please double check in your “Project Settings > Environment” tab that everything is configured correctly?

Still can’t find it. Checked all .-files. After which command it is supposed to be generated?


I guess you can’t see my production URL because I can’t move forward on this step (probably because .forestadmin-schema.json is missing)…

Still can’t find it. Checked all . -files. After which command it is supposed to be generated?

As stated above, this file is generated & update on each server start-up on a local/development environment.

I guess you can’t see my production URL because I can’t move forward on this step (probably because .forestadmin-schema.json is missing)…

That’s the issue indeed.
However, I can clearly see that you have a .forestadmin-schema.json somewhere on my end. (Since you confirmed that your project is running locally & I can see that the file is synced on our server for your local environment).

Could you check the value of NODE_ENV inside your running container? (It must be something like dev/development locally for this file to be generated)
Did you check both the shared volume on your host & in your running local container?

The generated .env file didn’t have NODE_ENV variable. I manually added NODE_ENV=development and finally .forestadmin-schema.json appeared.

Ok, good to know.

Default nodejs installation should not set any value in NODE_ENV (That’s also an allowed value for the schema to be generated). Did you setup a default value for NODE_ENV on your host or in your docker setup? That would explain why it was not working.

Let me know :pray:

If I’m not mistaken, I didn’t touch .env on my host and I definitely didn’t change any Docker configs. Strange.

Anyways, I was able to deploy it, thank you for your help!

1 Like