Max
06/14/2020, 8:02 PMError: @prisma/client did not initialize yet. Please run "prisma generate" and try to import it again.
when i run dk exec <c_name> npx prisma generate
it says it's ready to use, then I attempt to dk exec <c_name> npx prisma introspect
and I get
`Can't reach database server at `postgres`:`5432
I can confirm the db is working and that without docker the introspection works, ive a volume setup which connects the docker container app folder and the local one, when I change the prisma/.env
url string to something else and cat
to ensure it has changed it works but when I run introspect
in the container again it says that it cannot connect with the default 5432
port even though I changed itjanpio
06/14/2020, 8:06 PMintrospect
?Max
06/14/2020, 8:08 PMDATABASE_URL="<postgresql://user@localhost:5432/db>"
---
# docker exec <c_name> npx prisma introspect
Environment variables loaded from ./prisma/.env
Introspecting based on datasource defined in prisma/schema.prisma ā¦
Error: P1001
Can't reach database server at `postgres`:`5432`
Please make sure your database server is running at `postgres`:`5432`.
introspect
in the container after changing the port in prisma/.env
results in the same error with the same port even though it's changed which leads me to believe it may be prisma's faultjanpio
06/14/2020, 8:13 PMMax
06/14/2020, 8:16 PM⯠dkex back cat prisma/.env
DATABASE_URL="<postgresql://user:secret@localhost:2000/db>"
⯠dkex back npx prisma introspect
Can't reach database server at `postgres`:`5432`
janpio
06/14/2020, 8:25 PMMax
06/14/2020, 8:25 PMjanpio
06/14/2020, 8:25 PMDATABASE_URL
is set manually somehow maybe? (not that it should influence that)Max
06/14/2020, 8:28 PMDATABASE_URL
it was taking it from therejanpio
06/14/2020, 8:29 PMMax
06/14/2020, 8:29 PMjanpio
06/14/2020, 8:29 PMMax
06/14/2020, 8:30 PMjanpio
06/14/2020, 8:30 PMMax
06/14/2020, 8:30 PM.env
which is in the root of my project managed by dotenv
dep. which would take precedence (could I omit the prisma/.env
file entirely in that scenario)janpio
06/14/2020, 8:32 PMMax
06/14/2020, 8:33 PMjanpio
06/14/2020, 8:33 PMprisma/.env
is just a default location we read by convention.Max
06/14/2020, 8:33 PMjanpio
06/14/2020, 8:37 PMMax
06/14/2020, 9:53 PMjanpio
06/14/2020, 10:34 PMRichard Ward
06/15/2020, 4:19 PM.env
file is use your general one in your root, put the DB connection string in there and then:
cd prisma
ln -s ../.env
That will create a link prisma/.env
which links to your project .env
Max
06/15/2020, 10:52 PM