Chapter 6 of tutorial missing await when using console

There is what I think is a small mistake in chapter 6 of tutorial.

In the section showing how to use the console, the example command line does not contain await. As soon as I press the dot after db. my CPU goes to 100% and I cannot stop the process apart from doing a kill -9.

I read the documentation and found that there was a required “await” before any query. I think this should be in the tutorial.

e.g.

await db.posts.findMany()

instead of

db.posts.findMany()

Not sure if there is a better place to report such issues ?

Hmmm I just realized I did not read far enough the Tutorial. It says just later that await is inserted automatically by the console.

But obviously this is not the case on my PC, not sure why. I’m using redwoodjs 6.3.1.

Hey @oboudry, I agree this is a frustrating issue right now that the auto-complete causes such a performance problem. I think this is related to [Bug?]: `yarn rw console` hangs for 10 seconds when typing 'db' · Issue #8817 · redwoodjs/redwood · GitHub ? It’s certainly something that would be good to fix and we’d be more than happy to help out if you thought you could help tackle it? No pressure of course!

Hi @Josh-Walker-GM,

My understanding is that the db operation is async and requires an await statement. It’s only when I forget to put the await statement before typing db that it hangs. With the await statement all works as expected. When forgetting the await statement it hangs at 100% cpu for a very long time. I systematically killed the process to recover usability of my PC. I must admit I work on an old PC (11 years) running Ubuntu. So maybe if I would wait for very long it would end up.

What surprises me (and I read this after posting the initial message), is that according to the tutorial, the console automatically adds the await statement so the user does not have to type it every time. I suspect this behavior has changed to open it to more than just db operations.

I’d be glad to help if I can but at that time I’m not sure how.

1 Like