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

[Bug?]: yarn rw console hangs for 10 seconds when typing 'db' #8817

Closed
1 task done
kalaracey opened this issue Jul 3, 2023 · 8 comments · Fixed by #9623
Closed
1 task done

[Bug?]: yarn rw console hangs for 10 seconds when typing 'db' #8817

kalaracey opened this issue Jul 3, 2023 · 8 comments · Fixed by #9623
Labels
bug/confirmed We have confirmed this is a bug p3 Low priority. The Core team will not prioritize this for now

Comments

@kalaracey
Copy link

kalaracey commented Jul 3, 2023

What's not working?

I am going through the tutorial and I have gotten to the part where you begin to use yarn rw console. However, when I type db. (i.e. the beginning of db.post.findMany(...)) the console hangs for five to ten seconds at db. If I backspace from e.g. db.post to the 'd' character, it will similarly hang at db before backspacing through 'b' for five to ten seconds.

Perhaps there is some sort of autocomplete that is blocking the thread.

How do we reproduce the bug?

git clone https://github.com/redwoodjs/redwood-tutorial
cd redwood-tutorial
yarn install
yarn rw prisma migrate dev
yarn rw g secret

Then set up the SESSION_SECRET in .env.

Finally, open yarn rw console and attempt to type db.post.findMany().

What's your environment? (If it applies)

System:
    OS: macOS 13.4.1
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 18.16.1 - /private/var/folders/23/82ghc8m51fx3c774b2v_hcxw0000gn/T/xfs-18826e57/node
    Yarn: 3.3.1 - /private/var/folders/23/82ghc8m51fx3c774b2v_hcxw0000gn/T/xfs-18826e57/yarn
  Databases:
    SQLite: 3.39.5 - /usr/bin/sqlite3
  Browsers:
    Chrome: 114.0.5735.198
    Safari: 16.5.1
  npmPackages:
    @redwoodjs/auth-dbauth-setup: 5.0.0 => 5.0.0 
    @redwoodjs/core: 5.0.0 => 5.0.0

Are you interested in working on this?

  • I'm interested in working on this
@kalaracey kalaracey added the bug/needs-info More information is needed for reproduction label Jul 3, 2023
@Josh-Walker-GM
Copy link
Collaborator

Hey @kalaracey thanks for opening the issue! I can reproduce this behaviour on our test project so it's definitely happening.

Looking at the git history it looks like this command hasn't had much attention for a long time. I wasn't on the team when this was created so don't have any specific insight to offer at the moment. I can do my best to try and help you out if there's anything specific you come across.

A little notice since you said you'd be interested in working on this - which is awesome btw! The team is trying to focus on a few important milestones for our next epoch so we might not be able to be as responsive to this issue as we would like to be. I'll still try to make sure we get back to you though!

@Josh-Walker-GM Josh-Walker-GM added bug/confirmed We have confirmed this is a bug and removed bug/needs-info More information is needed for reproduction labels Jul 4, 2023
@dustinsgoodman
Copy link
Contributor

I've been running into this. Sharing some debug info I found today - if you paste something that goes past the "db", the console doesn't hang, e.g. db.. Seems like it's an issue with how the repl is interpreting the prisma client accessed through db.

@cyberious
Copy link

Additionally, when you open a console, as long as you do not start with db it does not freeze. It seems like some eager fetching off all possible Prisma objects in the DB or waiting on a promise that may never come.

> var posts = db.post.findMany()
undefined
> posts
[
  {
    id: 1,
    title: 'Welcome to the blog!',
    body: "I'm baby single- origin coffee kickstarter lo - fi paleo skateboard.Tumblr hashtag austin whatever DIY plaid knausgaard fanny pack messenger bag blog next level woke.Ethical bitters fixie freegan,helvetica pitchfork 90's tbh chillwave mustache godard subway tile ramps art party. Hammock sustainable twee yr bushwick disrupt unicorn, before they sold out direct trade chicharrones etsy polaroid hoodie. Gentrify offal hoodie fingerstache.",
    createdAt: 2023-10-14T23:29:54.403Z
  },
  {
    id: 2,
    title: 'A little more about me',
    body: "Raclette shoreditch before they sold out lyft. Ethical bicycle rights meh prism twee. Tote bag ennui vice, slow-carb taiyaki crucifix whatever you probably haven't heard of them jianbing raw denim DIY hot chicken. Chillwave blog succulents freegan synth af ramps poutine wayfarers yr seitan roof party squid. Jianbing flexitarian gentrify hexagon portland single-origin coffee raclette gluten-free. Coloring book cloud bread street art kitsch lumbersexual af distillery ethical ugh thundercats roof party poke chillwave. 90's palo santo green juice subway tile, prism viral butcher selvage etsy pitchfork sriracha tumeric bushwick.",
    createdAt: 2023-10-14T23:29:54.407Z
  },
  {
    id: 3,
    title: 'What is the meaning of life?',
    body: 'Meh waistcoat succulents umami asymmetrical, hoodie post-ironic paleo chillwave tote bag. Trust fund kitsch waistcoat vape, cray offal gochujang food truck cloud bread enamel pin forage. Roof party chambray ugh occupy fam stumptown. Dreamcatcher tousled snackwave, typewriter lyft unicorn pabst portland blue bottle locavore squid PBR&B tattooed.',
    createdAt: 2023-10-14T23:29:54.411Z
  }
]
>

Additionally, even using await in front of db the query works with absolutely zero hang.

@beardo01
Copy link

beardo01 commented Nov 1, 2023

I am also seeing this, however it doesn't seem to resolve itself even after waiting 10 seconds. Pasting directly into the terminal works and prefixing with await also works.

@Tobbe
Copy link
Member

Tobbe commented Nov 28, 2023

The console isn't getting much use, so we likely won't get to investigating this anytime soon. But please keep commenting and/or reacting to posts to indicate interest in this issue to keep it on our radar ✈️

@Tobbe Tobbe added the p3 Low priority. The Core team will not prioritize this for now label Nov 28, 2023
@ymc9
Copy link
Contributor

ymc9 commented Dec 2, 2023

It should be caused by this one: prisma/prisma#18292

Mind if I make a PR @Tobbe ?

@Tobbe
Copy link
Member

Tobbe commented Dec 4, 2023

@ymc9 Please do! 👍

@ymc9
Copy link
Contributor

ymc9 commented Dec 4, 2023

@ymc9 Please do! 👍

Sure. Here you go 😄: #9623

jtoar pushed a commit that referenced this issue Dec 5, 2023
…sole to hang (#9623)

The related Prisma issue: prisma/prisma#18292

It basically causes all kinds of Node REPLs that use PrismaClient to
hang when users type the variable name that holds the client. Adding a
workaround as suggested in the Prisma thread.

Fixes #8817
jtoar pushed a commit that referenced this issue Dec 5, 2023
…sole to hang (#9623)

The related Prisma issue: prisma/prisma#18292

It basically causes all kinds of Node REPLs that use PrismaClient to
hang when users type the variable name that holds the client. Adding a
workaround as suggested in the Prisma thread.

Fixes #8817
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/confirmed We have confirmed this is a bug p3 Low priority. The Core team will not prioritize this for now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants