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

Console hangs when I type db. #4365

Open
danmaz74 opened this issue Jul 28, 2024 · 3 comments
Open

Console hangs when I type db. #4365

danmaz74 opened this issue Jul 28, 2024 · 3 comments

Comments

@danmaz74
Copy link

danmaz74 commented Jul 28, 2024

What is the problem?

I want to work on users in the DB from the console, so I start typing db.user.findMany()

As soon as I type the first dot after db, the console hangs (forever) with node using 99.9% CPU (I suppose it's trying to do something for autocomplete?)

I was originally on 2.0.8, just tried to upgrade to 2.0.10 and have the same result. I also tried on both an Intel and an ARM mac.

If I try to execute some simple command, eg 1+1, it works. If I try typing something with a dot, like test.something , it doesn't get stuck.

The app works well from the web; my DB is postgresql, and all other configuration is the default.

I also just found out that if I paste db.user.findMany() (instead of typing each letter) it works correctly.

Paste all your error logs here:

PASTE_HERE (leave the ``` marks)

Paste all relevant code snippets here:

db.user.findMany()

What are detailed steps to reproduce this?

  1. blitz c
  2. try to type (not copy and paste) db.user.findMany()

Run blitz -v and paste the output here:

Blitz version: 2.0.10 (local)
macOS Sonoma | darwin-arm64 | Node: v22.5.1


 Package manager: npm

  System:
    OS: macOS 14.5
    CPU: (10) arm64 Apple M1 Pro
    Memory: 1.59 GB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 22.5.1 - ~/.nvm/versions/node/v22.5.1/bin/node
    Yarn: 1.22.22 - /opt/homebrew/bin/yarn
    npm: 10.8.2 - ~/.nvm/versions/node/v22.5.1/bin/npm
  npmPackages:
    @blitzjs/auth: 2.0.10 => 2.0.10 
    @blitzjs/next: 2.0.10 => 2.0.10 
    @blitzjs/rpc: 2.0.10 => 2.0.10 
    @prisma/client: 5.4.2 => 5.4.2 
    blitz: 2.0.10 => 2.0.10 
    next: 14.1.4 => 14.1.4 
    prisma: 5.4.2 => 5.4.2 
    react: 18.2.0 => 18.2.0 
    react-dom: 18.2.0 => 18.2.0 
    typescript: ^4.8.4 => 4.9.5 

Please include below any other applicable logs and screenshots that show your problem:

No response

@danmaz74 danmaz74 added kind/bug Something isn't working status/triage labels Jul 28, 2024
@siddhsuresh
Copy link
Member

@danmaz74 I cannot replicate. What is the size of the db?

@kzonov
Copy link

kzonov commented Feb 11, 2025

I can confirm this issue on my end. I'm on a fresh installation of Blitz (2.2.1), just switched to Postgres instead of Sqlite, added a few models and hit this issue. If I check Activity Monitor, I see that node process eats up 98% CPU.
The same as the author, if I copy-paste (not type) db.user.findMany(), it actually works. So it looks like the Blitz Console tries to fetch some db (meta-)data that makes it hang.

@kzonov
Copy link

kzonov commented Feb 13, 2025

For people coming here after me. What helped me was not typing db, but instead await db and then you can proceed inputing your command and using the autocompletion. I'm not sure what the root of the problem is, but I hope this would unblock someone coming here with the same issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants