Error while generating project Docker PostgreSQL (forestadmin/lumber)

Following the installation process on http://app.forestadmin.com for the first time. Created a database and table under the public schema in PostgreSQL.

Expected behavior

Finish generating and setting up the project.

Actual behavior

The docker run command throws an error.

Failure Logs

What I get when I execute docker run ...:

✓ Connecting to your database
✖ Analyzing the database
> Cannot generate your project.
> An unexpected error occurred. Please reach out for help in our Developers community (https://community.forestadmin.com/) or create a Github issue with following error: SequelizeDatabaseError: syntax error at or near "("
(node:16) UnhandledPromiseRejectionWarning: SequelizeDatabaseError: syntax error at or near "("
    at Query.formatError (/usr/local/lib/node_modules/lumber-cli/node_modules/sequelize/lib/dialects/postgres/query.js:366:16)
    at query.catch.err (/usr/local/lib/node_modules/lumber-cli/node_modules/sequelize/lib/dialects/postgres/query.js:72:18)
    at tryCatcher (/usr/local/lib/node_modules/lumber-cli/node_modules/bluebird/js/release/util.js:16:23)
    at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/lumber-cli/node_modules/bluebird/js/release/promise.js:547:31)
    at Promise._settlePromise (/usr/local/lib/node_modules/lumber-cli/node_modules/bluebird/js/release/promise.js:604:18)
    at Promise._settlePromise0 (/usr/local/lib/node_modules/lumber-cli/node_modules/bluebird/js/release/promise.js:649:10)
    at Promise._settlePromises (/usr/local/lib/node_modules/lumber-cli/node_modules/bluebird/js/release/promise.js:725:18)
    at _drainQueueStep (/usr/local/lib/node_modules/lumber-cli/node_modules/bluebird/js/release/async.js:93:12)
    at _drainQueue (/usr/local/lib/node_modules/lumber-cli/node_modules/bluebird/js/release/async.js:86:9)
    at Async._drainQueues (/usr/local/lib/node_modules/lumber-cli/node_modules/bluebird/js/release/async.js:102:5)
    at Immediate.Async.drainQueues [as _onImmediate] (/usr/local/lib/node_modules/lumber-cli/node_modules/bluebird/js/release/async.js:15:14)
    at runCallback (timers.js:705:18)
    at tryOnImmediate (timers.js:676:5)
    at processImmediate (timers.js:658:5)
(node:16) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 1)
(node:16) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Context

Database structure and data (empty right now):

--
-- PostgreSQL database dump
--

SET statement_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;

SET search_path = public, pg_catalog;

SET default_tablespace = '';

SET default_with_oids = false;

--
-- Name: users; Type: TABLE; Schema: public; Owner: desq; Tablespace: 
--

CREATE TABLE users (
    id integer NOT NULL,
    username character varying(256),
    password character varying(256),
    email character varying(256)
);


ALTER TABLE public.users OWNER TO desq;

--
-- Name: users_id_seq; Type: SEQUENCE; Schema: public; Owner: desq
--

CREATE SEQUENCE users_id_seq
    START WITH 1
    INCREMENT BY 1
    NO MINVALUE
    NO MAXVALUE
    CACHE 1;


ALTER TABLE public.users_id_seq OWNER TO desq;

--
-- Name: users_id_seq; Type: SEQUENCE OWNED BY; Schema: public; Owner: desq
--

ALTER SEQUENCE users_id_seq OWNED BY users.id;


--
-- Name: id; Type: DEFAULT; Schema: public; Owner: desq
--

ALTER TABLE ONLY users ALTER COLUMN id SET DEFAULT nextval('users_id_seq'::regclass);


--
-- Data for Name: users; Type: TABLE DATA; Schema: public; Owner: desq
--

COPY users (id, username, password, email) FROM stdin;
\.


--
-- Name: users_id_seq; Type: SEQUENCE SET; Schema: public; Owner: desq
--

SELECT pg_catalog.setval('users_id_seq', 1, false);


--
-- Name: users_pkey; Type: CONSTRAINT; Schema: public; Owner: desq; Tablespace: 
--

ALTER TABLE ONLY users
    ADD CONSTRAINT users_pkey PRIMARY KEY (id);


--
-- PostgreSQL database dump complete
--
  • Package Version: Not sure where to find these.
  • Express Version:
  • Sequelize Version:
  • Database Dialect: psql
  • Database Version: postgres (PostgreSQL) 9.2.24
  • Project Name:

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

I had to tweak a little your database structure a little, but I’m currently not able to reproduce with both npm & docker installation process.
In order to help you, could you provide me:

  • The lumber version your are using (docker run --rm forestadmin/lumber bash -c "lumber --version" if you fully tried with docker)
  • The command the onboarding generated ? (With sensible data obfuscated)
  • The name of the project you created

The error indicate an issue in the generation of the files process, so maybe the tweak I made on your provided SQL schema fixed it on my end ? :thinking:

Not sure where to find these

You’ll be able once your project is generated in your package.json file.

Hey @jeffladiray, thanks for your response!

As I mentioned, I couldn’t fully generate my project, it gets stuck at the generating process.

The points you requested:

  • Lumber version: 3.10.4
  • Project name: desq

Generated command:

docker run --add-host=host.docker.internal:host-gateway \
  -v `pwd`:/usr/src/app --init \
  -e DATABASE_SCHEMA="public" \
  -e DATABASE_SSL="false" \
  -e DATABASE_URL="postgres://desq:***@host.docker.internal:5432/desq_poc_db" \
  -e APP_NAME="desq-poc" \
  -e FOREST_EMAIL="***" \
  -e FOREST_TOKEN="***" \
  -e APPLICATION_HOST="localhost" \
  -e APPLICATION_PORT="3310" \
  -ti forestadmin/lumber

What have you changed about the SQL schema structure?

What have you changed about the SQL schema structure?

Not much, I removed the stdin part and switch to another user in database.

But, my bad on my first message, I did my tests with postgres@9.5.6. According to this link, postgres@9.2.x does not seem to be supported anymore.

If that’s an option, and from what I tested, your SQL script seems to work fine on 9.5.6 with the latest lumber version, so I would suggest to upgrade to a more recent version of PG.

Let me know if that helps.

Hey @jeffladiray,

Thanks for getting back to me so quickly. I finally managed to upgrade PostgreSQL to version 13 and the project generation works succesfully now.

But continuing the flow, I get the following error message when executing docker-compose up:

[forest] 🌳🌳🌳  An error occured while retrieving your IP whitelist. Your Forest envSecret seems to be missing or unknown. Can you check that you properly set your Forest envSecret in the Forest initializer?

Can’t really find anything about this error message. I double checked the .env file and it looks correct, filled out and no syntax errors. Am I missing something?

I’m running into the same issue. Any help?

Hello @nacho ,

Thank you for sharing this.

Could you post your docker-compose.yml file here so we can better investigate?

Thank you, Guillaume. Harold has already helped me, I had to comment out the FOREST_URL line in docker-compose.yml :+1:

1 Like