Unable to open database file error on tutorial2

Hello everyone,
Quick newbie question with respect to tutorial2 (Prerequisites | Learn RedwoodJS). I got a clone of tutorial1 at GitHub - redwoodjs/redwood-tutorial: The end state after completing the RedwoodJS introduction tutorial and when I ran it, it gave an error related to toaster (which I fixed). When I run the yarn rw test command, I get a Response: Database error: Error querying the database: unable to open database file: /c/temp/redwood-tutorial/.redwood/test.db error.

What am I missing?

Hello, @ajitgoel, welcome to the Redwood Community forum

Your problem might be the same that took me a long time to solve (meaning that I am a RedwoodJS novice a bit longer than you are). However, my case has nothing to do with testing (did not reach that point yet) - it the issue with hydrating the database cloned from GitHub

When you create a clone of an RW application (RW is RedwoodJS alias), the state of this application is different from this identical application that you typed in from scratch - Quick Start is a good example of such mini-tutorial.

The difference between the clone and the original stems from the .gitignore file, which is used to filter out parts of your original app when you “push” it to GitHub:


Your application’s database is not persisted in Github - and such behavior gave me a lot of a hard time because I could not find any document that explains how to solve this. By using the trial and error method, I deduced that cloning a RedwoodJS app GitHub

requires one additional step after git clone ...

yarn rw prisma migrate dev

This will bring the clone to the point where the dev.db exists:

but is empty


Open question:

  • Is this behavior that I just described a feature or a bug (I could envision that the command yarn rw dev could include the command yarn rw prisma migrate dev, just like the command yarn create redwood-app my-redwood-app invokes yarn install behind the scene). I do not have sufficient RW experience to claim that it is a bug, but would dare to say that the fix for your problem yarn rw prisma migrate dev should be a part of the documentation for beginners.
1 Like

Thank you @adriatic for your extremely detailed response. I ran the command and I see that the dev.db file is created in the api\db folder. However the yarn rw test command is looking for the test.db file in the .redwood folder.
What am I missing?

Cannot answer your “What am I missing?” question as I never did any testing with RWJS app. Nevertheless, I am pretty sure that your issue is directly related to the cloned app database hydration issue, I described above.

My advice is to run the test for the original application (assuming that you typed in following a tutorial) and then compare it with the clone (app that is created by pushing the original into GitHub). Use DB browser for SQLite to inspect the dev.db database.

See my posts

Neither of them got any response from the community :smile_cat:

P.S. I am assuming that you are aware of the testing document (I have not yet learned it)

Thanks @adriatic, sorry I am sounding rude but I am not.
I will read some more or perhaps start from tutorial 1.

You are not sounding rode, not at all. I am sorry that I am not able to provide the complete answer to your original question, though :cold_sweat: