Aha! So this is related specifically to running postgres on vercel. If you follow the standard setup, you are given env variables like POSTGRES_PRISMA_URL
for your database url. I made the mistake of changing the DATABASE_URL
reference in schema.prisma
to POSTGRES_PRISMA_URL
.
The RedwoodJS test helper overrides DATABASE_URL
only:
process.env.DATABASE_URL = process.env.TEST_DATABASE_URL || defaultDb
You can’t edit the auto-generated vercel postgres env vars, so I added DATABASE_URL
and DATABASE_URL_NON_POOLING
manually, just pointing to the same auto-generated values for POSTGRES_PRISMA_URL
and POSTGRES_URL_NON_POOLING
, respectively.
The reason this was happening on save was actually from the Jest extension was auto running the test, causing yarn rw prisma db push
to get called, which was hitting my dev database because the schema pointed to POSTGRES_PRISMA_URL
which the RedwoodJS testing utils obviously don’t override.
I’ll leave this up for searchability in case anyone else stumbles into this. Thanks for the rubber duck!