"TypeError: Cannot read property 'datasources' of undefined" after command "prisma db reset"
See original GitHub issueUsing prisma client 2.13.1 the issue https://github.com/prisma/migrate/issues/653 remains.
The issue was (see link for more details) :
$ yarn blitz db reset
yarn run v1.22.5
$ /PATH_TO_MY_APP/node_modules/.bin/blitz db reset
You are using alpha software - if you have any problems, please open an issue here:
https://github.com/blitz-js/blitz/issues/new/choose
✔ Loading your database
✔ Are you sure you want to reset your database and erase ALL data? (y/N) · true
tryLoadEnv Environment variables loaded from /PATH_TO_MY_APP/.env +0ms
tryLoadEnv Environment variables loaded from /PATH_TO_MY_APP/.env +2ms
prisma-client { clientVersion: '2.13.1' } +0ms
TypeError: Cannot read property 'datasources' of undefined
Done in 4.54s.
My new env:
$ ./node_modules/.bin/prisma -v
Environment variables loaded from .env
@prisma/cli : 2.13.1
@prisma/client : 2.13.1
Current platform : debian-openssl-1.1.x
Query Engine : query-engine fcbc4bb2d306c86c28014f596b1e8c7980af8bd4 (at node_modules/@prisma/engines/query-engine-debian-openssl-1.1.x)
Migration Engine : migration-engine-cli fcbc4bb2d306c86c28014f596b1e8c7980af8bd4 (at node_modules/@prisma/engines/migration-engine-debian-openssl-1.1.x)
Introspection Engine : introspection-core fcbc4bb2d306c86c28014f596b1e8c7980af8bd4 (at node_modules/@prisma/engines/introspection-engine-debian-openssl-1.1.x)
Format Binary : prisma-fmt fcbc4bb2d306c86c28014f596b1e8c7980af8bd4 (at node_modules/@prisma/engines/prisma-fmt-debian-openssl-1.1.x)
Studio : 0.329.0
Done in 1.94s.
$ node -v
v14.15.3
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
"TypeError: Cannot read property 'datasources' of undefined ...
Bug description prisma db reset fails with error message: TypeError: Cannot read property 'datasources' of undefined The output with env ...
Read more >Error message reference - Prisma
Prisma Client throws a PrismaClientUnknownRequestError exception if the query engine returns an error related to a request that does not have an error...
Read more >"Property does not exist" when I want to use model added in ...
I tried prisma generate and prisma migrate dev but was still having the same error. I had to restart VSCode and everything is...
Read more >Prisma | NestJS - A progressive Node.js framework
You are going to build a sample NestJS application with a REST API that can read and write data in a database. For...
Read more >Database problems - Get Help and Help Others
That error most often occurs when the DB either doesn't exist (local development) or it's not connected/updated. For local development, after ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
It looks like the problem is from Blitz’s implementation here https://github.com/blitz-js/blitz/blob/canary/packages/cli/src/commands/db.ts#L261-L301
It’s using some parts of Prisma that are undocumented / reserved for internal use and something is probably not working as expected.
I think this issue needs to be opened in Blitz’s repo https://github.com/blitz-js/blitz/issues/new/choose
Hey @Jolg42
the variable
"DATABASE_URL"
is well defined in.env
.datasources
instead ofdatasource
but the result is the same.I also try to remove the whole datasource block and the result is the same, which make me think that the problem might be that the command
reset
doesn’t really consider theschema.prisma
file.There is also no issues with the command
migrate.
Also when I remove the block datasource of theschema.prisma
and runmigrate
it fails appropriately.It’s not clear why the command
reset
doesn’t fail in the same way when removing the datasource block.