Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Development mode dont open localhost:3000 #1974

Closed
wesleyalmd opened this issue Jan 24, 2025 · 8 comments
Closed

Development mode dont open localhost:3000 #1974

wesleyalmd opened this issue Jan 24, 2025 · 8 comments

Comments

@wesleyalmd
Copy link

I going to start project following steps from docs:https://docs.typebot.io/contribute/guides/local-installation

And open browser on http, but window dont open typebot page and stay infinte looping

Image

Image

Has anyone experienced this problem?

@baptisteArno
Copy link
Owner

That's odd. nothing showing in the logs? Can you record a video?

@wesleyalmd
Copy link
Author

@bnaidoo
Copy link

bnaidoo commented Jan 25, 2025

Hello gents can you help me with a guide on installing locally im having issues

@baptisteArno
Copy link
Owner

Can you also look for any errors in the docker containers logs?

@wesleyalmd
Copy link
Author

@baptisteArno see docker-compose logs

Image

I will try to set up the project on the vs code server or on another computer, if it works I will provide feedback

@bnaidoo
Copy link

bnaidoo commented Jan 26, 2025

@baptisteArno ive managed to install this successfully using these steps; ________________________________________
Complete Manual Installation Guide for Typebot


Step 1: Prerequisites

  1. Server Setup:
    o Operating System: Unix-based (e.g., Ubuntu 20.04/22.04).
    o Installed Software:
     Node.js (v20 or higher)
     Bun (fast JavaScript runtime)
     Nginx (reverse proxy and SSL termination)
     PM2 (process manager for Node.js apps)
     PostgreSQL (for the database)
  2. Domain Names:
    o Use DuckDNS or any DNS provider for your domains:
     Builder: typebotbuilder.duckdns.org
     Viewer: typebotai.duckdns.org
  3. SSL Certificates:
    o Optional but recommended: Let’s Encrypt for HTTPS setup.

Step 2: Prepare Your Environment

  1. Update Your System:
  2. sudo apt update && sudo apt upgrade -y
  3. Install Node.js: Use nvm to install Node.js v20:
  4. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
  5. source ~/.bashrc
  6. nvm install 20
  7. nvm use 20
  8. Install Bun:
  9. curl -fsSL https://bun.sh/install | bash
  10. source ~/.bashrc
  11. Install PM2:
  12. npm install -g pm2
  13. Install Nginx:
  14. sudo apt install nginx -y
  15. Install PostgreSQL:
  16. sudo apt install postgresql postgresql-contrib -y
  17. Start and Enable PostgreSQL:
  18. sudo systemctl start postgresql
  19. sudo systemctl enable postgresql

Step 3: Configure PostgreSQL

  1. Log in to PostgreSQL:
  2. sudo -u postgres psql
  3. Create a Database and User:
  4. CREATE DATABASE typebotdb;
  5. CREATE USER typebotuser WITH PASSWORD 'your_secure_password';
  6. GRANT ALL PRIVILEGES ON DATABASE typebotdb TO typebotuser;
  7. \q

Step 4: Clone and Configure Typebot

  1. Clone the Repository:
  2. git clone https://github.com/baptisteArno/typebot.io.git
  3. cd typebot.io
  4. git checkout latest
  5. Set Up the Environment Variables: Copy the example .env file and edit it:
  6. cp .env.example .env
  7. nano .env
    Update the following variables in .env:

Application URLs

NEXTAUTH_URL=https://typebotbuilder.duckdns.org
NEXT_PUBLIC_VIEWER_URL=https://typebotai.duckdns.org

Database Configuration

DATABASE_URL=postgresql://typebotuser:your_secure_password@localhost:5432/typebotdb

Admin Credentials

ADMIN_EMAIL=[email protected]
ADMIN_PASSWORD=Kite1245!

Encryption Secret

ENCRYPTION_SECRET=your_random_secret_key
o To generate a random secret:
o openssl rand -base64 32 | cut -c1-32
Without SSL: Replace https:// with http:// in NEXTAUTH_URL and NEXT_PUBLIC_VIEWER_URL.


Step 5: Install Dependencies and Build Applications

  1. Install Dependencies:
  2. bun install
  3. Build the Applications:
  4. bunx turbo build --filter=builder... --filter=viewer...
    If you encounter memory issues:
    NODE_OPTIONS=--max-old-space-size=4096 bunx turbo build --filter=builder... --filter=viewer...

Step 6: Deploy Applications Using PM2

  1. Start the Builder:
  2. cd apps/builder
  3. pm2 start --name=typebot-builder bun -- start -p 3001
  4. Start the Viewer:
  5. cd ../viewer
  6. pm2 start --name=typebot-viewer bun -- start -p 3002
  7. Save PM2 Process List:
  8. pm2 save
  9. Enable PM2 on Boot:
  10. pm2 startup systemd
  11. sudo systemctl enable pm2-$(whoami)
  12. sudo systemctl start pm2-$(whoami)

Step 7: Configure Nginx
Option 1: Without SSL (HTTP-Only)

  1. Configure Nginx for the builder:

  2. sudo nano /etc/nginx/sites-available/typebotbuilder
    Add:
    server {
    listen 80;
    server_name typebotbuilder.duckdns.org;

    location / {
    proxy_pass http://localhost:3001;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
    }
    }

  3. Configure Nginx for the viewer:

  4. sudo nano /etc/nginx/sites-available/typebotai
    Add:
    server {
    listen 80;
    server_name typebotai.duckdns.org;

    location / {
    proxy_pass http://localhost:3002;
    proxy_http_version 1.1;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection 'upgrade';
    proxy_set_header Host $host;
    proxy_cache_bypass $http_upgrade;
    }
    }
    Option 2: With SSL (HTTPS)
    Follow the previously provided SSL-enabled configuration for both builder and viewer.


Step 8: Enable and Test Nginx

  1. Enable the Nginx configurations:
  2. sudo ln -s /etc/nginx/sites-available/typebotbuilder /etc/nginx/sites-enabled/
  3. sudo ln -s /etc/nginx/sites-available/typebotai /etc/nginx/sites-enabled/
  4. Test the configuration:
  5. sudo nginx -t
  6. Restart Nginx:
  7. sudo systemctl restart nginx

Step 9: Obtain SSL Certificates (Optional)

  1. Install Certbot:
  2. sudo apt install certbot python3-certbot-nginx -y
  3. Obtain certificates:
  4. sudo certbot --nginx -d typebotbuilder.duckdns.org -d typebotai.duckdns.org
  5. Test auto-renewal:
  6. sudo certbot renew --dry-run

Step 10: Verify Deployment
• HTTP:
o Builder: http://typebotbuilder.duckdns.org
o Viewer: http://typebotai.duckdns.org
• HTTPS:
o Builder: https://typebotbuilder.duckdns.org
o Viewer: https://typebotai.duckdns.org


BUt i now get this error when trying to login

/root/.pm2/logs/typebot-builder-error.log last 15 lines:
0|typebot- |
0|typebot- |
0|typebot- | The table public.Account does not exist in the current database. PrismaClientKnownRequestError:
0|typebot- | Invalid prisma.account.findUnique() invocation:
0|typebot- |
0|typebot- |
0|typebot- | The table public.Account does not exist in the current database.
0|typebot- | at In.handleRequestError (/root/typebot.io/node_modules/@prisma/client/runtime/library.js:122:6854)
0|typebot- | at In.handleAndLogRequestError (/root/typebot.io/node_modules/@prisma/client/runtime/library.js:122:6188)
0|typebot- | at In.request (/root/typebot.io/node_modules/@prisma/client/runtime/library.js:122:5896)
0|typebot- | at async l (/root/typebot.io/node_modules/@prisma/client/runtime/library.js:127:11167)
0|typebot- | at async getUserByAccount (/root/typebot.io/apps/builder/.next/server/chunks/9463.js:1:1383) {
0|typebot- | name: 'GetUserByAccountError',
0|typebot- | code: 'P2021'
0|typebot- | }

0|typebot-builder | [next-auth][error][adapter_error_getUserByAccount]
0|typebot-builder | https://next-auth.js.org/errors#adapter_error_getuserbyaccount
0|typebot-builder | Invalid prisma.account.findUnique() invocation:
0|typebot-builder | The table public.Account does not exist in the current database. {
0|typebot-builder | message: '\n' +
0|typebot-builder | 'Invalid prisma.account.findUnique() invocation:\n' +
0|typebot-builder | '\n' +
0|typebot-builder | '\n' +
0|typebot-builder | 'The table public.Account does not exist in the current database.',
0|typebot-builder | stack: 'PrismaClientKnownRequestError: \n' +
0|typebot-builder | 'Invalid prisma.account.findUnique() invocation:\n' +
0|typebot-builder | '\n' +
0|typebot-builder | '\n' +
0|typebot-builder | 'The table public.Account does not exist in the current database.\n' +
0|typebot-builder | ' at In.handleRequestError (/root/typebot.io/node_modules/@prisma/client/runtime/library.js:122:6854)\n' +
0|typebot-builder | ' at In.handleAndLogRequestError (/root/typebot.io/node_modules/@prisma/client/runtime/library.js:122:6188)\n' +
0|typebot-builder | ' at In.request (/root/typebot.io/node_modules/@prisma/client/runtime/library.js:122:5896)\n' +
0|typebot-builder | ' at async l (/root/typebot.io/node_modules/@prisma/client/runtime/library.js:127:11167)\n' +
0|typebot-builder | ' at async getUserByAccount (/root/typebot.io/apps/builder/.next/server/chunks/9463.js:1:1383)',
0|typebot-builder | name: 'PrismaClientKnownRequestError'
0|typebot-builder | }
0|typebot-builder | [next-auth][error][OAUTH_CALLBACK_HANDLER_ERROR]
0|typebot-builder | https://next-auth.js.org/errors#oauth_callback_handler_error
0|typebot-builder | Invalid prisma.account.findUnique() invocation:
0|typebot-builder | The table public.Account does not exist in the current database. PrismaClientKnownRequestError:
0|typebot-builder | Invalid prisma.account.findUnique() invocation:
0|typebot-builder | The table public.Account does not exist in the current database.
0|typebot-builder | at In.handleRequestError (/root/typebot.io/node_modules/@prisma/client/runtime/library.js:122:6854)
0|typebot-builder | at In.handleAndLogRequestError (/root/typebot.io/node_modules/@prisma/client/runtime/library.js:122:6188)
0|typebot-builder | at In.request (/root/typebot.io/node_modules/@prisma/client/runtime/library.js:122:5896)
0|typebot-builder | at async l (/root/typebot.io/node_modules/@prisma/client/runtime/library.js:127:11167)
0|typebot-builder | at async getUserByAccount (/root/typebot.io/apps/builder/.next/server/chunks/9463.js:1:1383) {
0|typebot-builder | name: 'GetUserByAccountError',
0|typebot-builder | code: 'P2021'
0|typebot-builder | }

@wesleyalmd
Copy link
Author

I couldn't find the problem, I believe this is on my local machine (ubuntu 22)

As a workaround, I set up a droplet on Digital Ocean and connected my VS Code via SSH

If in the future I found the real cause of the problem I will post it here

@baptisteArno
Copy link
Owner

Thanks @wesleyalmd. Indeed I really don't know what's going on here.

Will close it but feel free to re-open 🙏

@baptisteArno baptisteArno closed this as not planned Won't fix, can't repro, duplicate, stale Jan 28, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants