blitz-js / blitz-js/blitz

Console hangs when I type db.

Open
#4,365 3 comments 1 reaction 0 assignees View on GitHub
awaiting response kind/bug status/triage
Dominant language
TypeScript
Stars
14.1k
Forks
803
PR merge metrics
No merged PRs in 30d

Description

### 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_

Contributor guide

Open the contributing guide

Research direction

Start with `blitz c` and reproduce the hang by typing `db.user.findMany()` character by character, comparing it with pasted input and a simple dotted expression. Trace the console's autocomplete behavior around the first dot and confirm that interactive typing remains responsive without excessive CPU use while database expressions still work.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, postgresql, typescript
Domain
cli, databases, developer-experience
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.