P4001 The introspected database was empty
See original GitHub issueBug description
When I initiate the introspect process I receive the above mentioned error waring
How to reproduce
- npm install @prisma/cli
- Enter my heroku postgresql url into the DATABASE_URL variable in prisma/.env
- npx run intropect
Expected behavior
I expected my database to be interrogated and the appropriate models to be created in the schema.
Prisma information
datasource db {
provider = "postgresql"
url = env("DATABASE_URL")
}
generator client {
provider = "prisma-client-js"
}
Environment & setup
- OS: Windows
- Database: PostgreSQL
- Prisma version: 2.2.0
- Node.js version: 10.16.0
Additional information

Logs
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\d0475\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'introspect' ]
2 info using npm@6.5.0
3 info using node@v10.16.0
4 verbose run-script [ 'preintrospect', 'introspect', 'postintrospect' ]
5 info lifecycle flamingo-backend@1.0.0~preintrospect: flamingo-backend@1.0.0
6 info lifecycle flamingo-backend@1.0.0~introspect: flamingo-backend@1.0.0
7 verbose lifecycle flamingo-backend@1.0.0~introspect: unsafe-perm in lifecycle true
8 verbose lifecycle flamingo-backend@1.0.0~introspect: PATH: C:\Users\d0475\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\d0475\Documents\Projects\flamingo-ecom2\sick-fits\backend\node_modules\.bin;C:\Users\d0475\Documents\Cmder\bin;C:\Program Files\Git\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\share\vim\vim74;C:\Users\d0475\Documents\Cmder\vendor\conemu-maximus5\ConEmu\Scripts;C:\Users\d0475\Documents\Cmder\vendor\conemu-maximus5;C:\Users\d0475\Documents\Cmder\vendor\conemu-maximus5\ConEmu;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Calibre2\;C:\WINDOWS\System32\LibreSSL\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Yarn\bin\;C:\Program Files (x86)\Gpg4win\..\GnuPG\bin;C:\Program Files\Git\cmd;C:\Users\d0475\AppData\Local\Microsoft\WindowsApps;C:\Users\d0475\AppData\Local\Microsoft\WindowsApps;;C:\Users\d0475\AppData\Local\now-cli;C:\Program Files\Heroku\bin;C:\Program Files\Microsoft VS Code\bin;C:\Users\d0475\AppData\Local\hyper\app-2.0.0\resources\bin;C:\Users\d0475\AppData\Roaming\npm;C:\Users\d0475\AppData\Local\Yarn\bin;C:\Users\d0475\Documents\Cmder
9 verbose lifecycle flamingo-backend@1.0.0~introspect: CWD: C:\Users\d0475\Documents\Projects\flamingo-ecom2\sick-fits\backend
10 silly lifecycle flamingo-backend@1.0.0~introspect: Args: [ '/d /s /c', 'npx prisma introspect' ]
11 silly lifecycle flamingo-backend@1.0.0~introspect: Returned: code: 1 signal: null
12 info lifecycle flamingo-backend@1.0.0~introspect: Failed to exec introspect script
13 verbose stack Error: flamingo-backend@1.0.0 introspect: `npx prisma introspect`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\d0475\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:198:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\d0475\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:198:13)
13 verbose stack at maybeClose (internal/child_process.js:982:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
14 verbose pkgid flamingo-backend@1.0.0
15 verbose cwd C:\Users\d0475\Documents\Projects\flamingo-ecom2\sick-fits\backend
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\d0475\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "introspect"
18 verbose node v10.16.0
19 verbose npm v6.5.0
20 error code ELIFECYCLE
21 error errno 1
22 error flamingo-backend@1.0.0 introspect: `npx prisma introspect`
22 error Exit status 1
23 error Failed at the flamingo-backend@1.0.0 introspect script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Issue Analytics
- State:
- Created 3 years ago
- Comments:6 (2 by maintainers)
Top Results From Across the Web
Prisma 1 to 2 migration issue: P4001 The introspected ...
All of my tables/data info resides in my-schema$prod . I initially presumed that I needed to change the search_path of the database to...
Read more >What is introspection? (Reference) - Prisma
Introspection has one main function: Populate your Prisma schema with a data model that reflects the current database schema. Introspect your database with ......
Read more >Introspect a database with Prisma (2/5) - YouTube
Website: https://www.prisma.ioQuickstart: https://www.prisma.io/docs/quickstartDocumentation: https://www.prisma.io/docs/Beta announcement: ...
Read more >Start using Prisma in your existing database with ... - Medium
Then add below line of code. DATABASE_URL="postgresql://test:test!@localhost:5432/test. Finally, run npx prisma introspect and see the ...
Read more >prisma-rays - npm
Error: P4001 The introspected database was empty while running rays prepare. your database is empty so it cannot be used to generate the ......
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 Free
Top 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
Hello @TheoMer
You can specify the schema in database url using
?schemaquery parameter.Example:
Let me know if this resolved the issue.
@janpio Ah yes, I see. I must’ve missed the link to the PostgreSQL-specific details at the bottom of the Connection URLs page.