Redwood: `yarn rw db save` never finishes on Windows [workaround]

Created on 21 May 2020  Â·  7Comments  Â·  Source: redwoodjs/redwood

I'm on Windows, following the tutorial.

$ node --version && yarn --version
v13.8.0
1.22.4
$ less node_modules/\@redwoodjs/core/package.json | grep version
  "version": "0.7.0",

GitBash
image

yarn rw db save never returns to the terminal

$ yarn rw db save
yarn run v1.22.4
$ C:\Users\tobbe\dev\redwood\redwoodblog\node_modules\.bin\rw db save
Creating database migration... [started]
$ C:\Users\tobbe\dev\redwood\redwoodblog\node_modules\.bin\prisma migrate save --experimental

That's as far as it gets. After that nothing else happens. I have to use Ctrl+C to kill it.

Update and Workaround

This is a known issue with Prisma on Windows. For current status see https://github.com/prisma/migrate/issues/342

Workaround:

  1. kill the process with Ctrl+C
  2. run the command again.

On second run the command will complete successfully.

bu2-confirmed prisma windows

All 7 comments

Running winpty bash first, and then re-running yarn rw db save I got prompted for the name to use, and the command could finish. After that I could exit out of the extra layer of bash and successfully run yarn rw db up

Did some more investigating. It's not as straight forward as I thought it was :(

I installed the latest rc of Git-for-Widows, as it comes with experimental support for ConPTY. But that didn't help :( Still hangs right before asking for the migration name. So I still have to kill it with Ctrl+C

After that, however, I can just re-run the command and it successfully asks for the migration name. (No need to run it through winpty.) I think it works the second time because then it doesn't have to ask about saving the db or not (dev.db).

Running DATABASE_URL=file:./dev.db BINARY_TARGET=native yarn prisma migrate save --experimental gives the exact same result as yarn rw db save. Adding --create-db to the command makes it work DATABASE_URL=file:./dev.db BINARY_TARGET=native yarn prisma migrate save --create-db --experimental

So if you're fine with creating the db with the default name without prompting an easy fix would be to add --create-db to save.js inside /dbCommands

Reproduced the error on Windows 10 using Powershell at package @redwoodjs 0.9.2-canary.1 (the equivalent of Prisma beta.9).

yarn rw db save shows the command runs prisma migrate save --experimental, however, the process stalls after the first prompt, and the Prisma Client is _not_ successfully generated.

Potentially Tutorial Breaking with Workaround
Re-running the command completes successfully. And yarn rw db up runs fine as well. ¯_(ツ)_/¯

This seems to be a prisma issue, see more here https://github.com/prisma/migrate/issues/342
Not sure there is much we can do until that is fixed

@cannikin I've messaged Jan in the Prisma Issue Tobbe reference above. I’m adding the workaround messaging here and on the forum. But thoughts about if we should add "workaround FYI" on Tutorial?

@thedavidprice Yeah we should add a little callout at that step in the Tutorial, maybe include a link to the issue on prisma's side. And whenever we find out it's been fixed we can remove. I added an issue at redwoodjs.com repo: https://github.com/redwoodjs/redwoodjs.com/issues/190

Was this page helpful?
0 / 5 - 0 ratings

Related issues

thedavidprice picture thedavidprice  Â·  3Comments

thedavidprice picture thedavidprice  Â·  3Comments

weaversam8 picture weaversam8  Â·  3Comments

Tobbe picture Tobbe  Â·  4Comments

freddydumont picture freddydumont  Â·  3Comments