question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unknown database type on db save

See original GitHub issue

While following along with the Tutorial, I got this error which is apparently due to the environment variable not getting loaded from .env.defaults:

$ yarn redwood db save yarn run v1.22.0 $ … redwoodblog/node_modules/.bin/redwood db save Creating database migration… [started] $ … redwoodblog/node_modules/.bin/prisma2 migrate save --experimental Error: Unknown database type error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command. Creating database migration… [failed] → Command failed with exit code 1: yarn prisma2 migrate save --experimental Command failed with exit code 1: yarn prisma2 migrate save --experimental ✨ Done in 2.05s.

$ yarn -v 1.22.0 $ node -v v12.14.0 “@redwoodjs/core”: “^0.2.0”

If I change api/prisma/schema.prisma from this:

datasource DS {
  provider = "sqlite"
  url = env("DATABASE_URL")
}

…to this:

datasource DS {
  provider = "sqlite"
  url = "file:./dev.db"
}

…it works fine.

I see in the prisma2 docs, it mentions that the .env file has to be in the same directory as the schema file. But I assume that Redwood is meant to be handling the loading of environment variables differently, so that it’s not necessary for the env file to be in the same directory.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (8 by maintainers)

github_iconTop GitHub Comments

2reactions
jvanbaarsencommented, Mar 14, 2020

Would it make sense to try and render the DB info that Redwood is trying to use in the error message? That way it can give people a hint on where to look for when they have problems.

1reaction
peterpcommented, Mar 14, 2020

@TravisL12 it sounds like you might be on an older version of Redwood since we changed from DB_HOST to DATABASE_URL.

Read more comments on GitHub >

github_iconTop Results From Across the Web

ERROR 1049 (42000): Unknown database - Stack Overflow
The problem is the when you import your database, you got any errors and then the database will be corrupted. The log files...
Read more >
How to create a database for unknown kinds of data?
My problem is that I do not and cannot represent what should be saved in the database because it is unlimited and changing....
Read more >
Resolve Unknown database in JDBC error with Java-MySQL?
Resolve Unknown database in JDBC error with Java-MySQL? - This type of error occurs if you select any database that does not exist...
Read more >
SQLSTATE[HY000] [1049] Unknown database 'laravel'
In this lesson, we learn how to fix the different types of errors that you might get in Laravel. In this lesson we...
Read more >
Munit DB Server parameterized operation = Unknown data type
Using munit DB Server component to test a db insert operation. I get this exception: Root Exception stack trace: org.h2.jdbc.JdbcSQLException: Unknown data ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found