Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

introspect fails on SQLite #1648

Closed
janpio opened this issue Feb 19, 2020 · 11 comments · Fixed by prisma/prisma-engines#697
Closed

introspect fails on SQLite #1648

janpio opened this issue Feb 19, 2020 · 11 comments · Fixed by prisma/prisma-engines#697
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. tech/engines Issue for tech Engines. topic: introspection topic: prisma db pull CLI: prisma db pull
Projects
Milestone

Comments

@janpio
Copy link
Contributor

janpio commented Feb 19, 2020

prisma/schema.prisma:

datasource db {
  provider = "sqlite"
  url      = "sqlite:./../1093.db"
}

generator client {
  provider = "prisma-client-js"
}

Zipped 1093.db file to put in root of project:
1093.zip
(originally via #1093 (comment))

When I run prisma2 introspect I get this:

C:\Users\Jan\Documents\throwaway\1093>prisma2 introspect
Introspecting based on datasource defined in prisma\schema.prisma …
Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
    at doWrite (_stream_writable.js:413:19)
    at writeOrBuffer (_stream_writable.js:401:5)
    at Socket.Writable.write (_stream_writable.js:301:11)
    at C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\build\index.js:2:884310
    at new Promise (<anonymous>)
    at IntrospectionEngine.<anonymous> (C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\build\index.js:2:883015)
    at Generator.next (<anonymous>)
    at fulfilled (C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\build\index.js:2:877318)
    at processTicksAndRejections (internal/process/task_queues.js:85:5)
 ERROR  Oops, an unexpected error occured!
[src\libcore\option.rs:1188:5] to

More info:

C:\Users\Jan\Documents\throwaway\1093>set DEBUG=*

C:\Users\Jan\Documents\throwaway\1093>prisma2 introspect
  prisma .env loaded from ./prisma/.env +0ms
  getos { platform: 'win32', libssl: undefined } +0ms
  cleanupCache Error: ENOENT: no such file or directory, scandir 'C:\Users\Jan\AppData\Roaming\Prisma\alpha' +0ms
  download Setting binary path for query-engine windows to C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\query-engine-windows.exe +0ms
  download Setting binary path for migration-engine windows to C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\migration-engine-windows.exe +1ms        
  download Setting binary path for introspection-engine windows to C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\introspection-engine-windows.exe +1ms
Introspecting based on datasource defined in prisma\schema.prisma …
  getos { platform: 'win32', libssl: undefined } +47ms
  IntrospectionEngine:rpc starting introspection engine with binary: C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\introspection-engine-windows.exe +0ms
  IntrospectionEngine:rpc SENDING RPC CALL {"id":1,"jsonrpc":"2.0","method":"introspect","params":[{"schema":"// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\ndatasource db {\n  provider = \"sqlite\"\n  
url      = \"sqlite:./../1093.db\"\n}\n\ngenerator client {\n  provider = \"prisma-client-js\"\n}\n"}]} +14ms
  IntrospectionEngine:stderr {"is_panic":true,"message":"[src\\libcore\\option.rs:1188:5] to","backtrace":"   0: backtrace::backtrace::trace\n   1: backtrace::capture::Backtrace::new\n   2: user_facing_errors::Error::new_in_panic_hook\n   3: user_facing_errors::panic_hook::set_panic_hook::{{closure}}\n   4: std::panicking::rust_panic_with_hook\n             at src\\libstd/panicking.rs:475\n   5: rust_begin_unwind\n             at src\\libstd/panicking.rs:375\n   6: core::panicking::panic_fmt\n             at src\\libcore/panicking.rs:84\n   7: core::option::expect_failed\n             at src\\libcore/option.rs:1188\n   8: sql_schema_describer::sqlite::SqlSchemaDescriber::get_table::{{closure}}\n   9: <std::future::GenFuture<T> as core::future::future::Future>::poll\n  10: std::future::poll_with_tls_context\n  11: <std::future::GenFuture<T> as core::future::future::Future>::poll\n  12: <std::future::GenFuture<T> as core::future::future::Future>::poll\n  13: <futures_util::compat::compat03as01::Compat<Fut> as futures::future::Future>::poll\n  14: <futures::future::map::Map<A,F> as futures::future::Future>::poll\n  15: <futures::future::map_err::MapErr<A,F> as futures::future::Future>::poll\n  16: <futures::future::either::Either<A,B> as futures::future::Future>::poll\n  17: <futures::future::lazy::Lazy<F,R> as futures::future::Future>::poll\n  18: futures::future::chain::Chain<A,B,C>::poll\n  19: <futures::future::then::Then<A,B,F> as futures::future::Future>::poll\n  20: <futures::future::either::Either<A,B> as futures::future::Future>::poll\n  21: <futures::future::map::Map<A,F> as futures::future::Future>::poll\n  22: <futures::future::either::Either<A,B> as futures::future::Future>::poll\n  23: <futures::future::map::Map<A,F> as futures::future::Future>::poll\n  24: futures::task_impl::std::set\n  25: <futures_util::compat::compat01as03::Compat01As03<Fut> as core::future::future::Future>::poll\n  26: <std::future::GenFuture<T> as core::future::future::Future>::poll\n  27: tokio::runtime::enter::Enter::block_on\n  28: tokio::runtime::thread_pool::ThreadPool::block_on\n  29: tokio::runtime::context::enter\n  30: tokio::runtime::handle::Handle::enter\n  31: introspection_engine::main\n  32: std::rt::lang_start::{{closure}}\n  33: std::rt::lang_start_internal::{{closure}}\n             at src\\libstd/rt.rs:52\n      std::panicking::try::do_call\n             at src\\libstd/panicking.rs:292\n  34: __rust_maybe_catch_panic\n             at src\\libpanic_unwind/lib.rs:78\n  35: std::panicking::try\n             at src\\libstd/panicking.rs:270\n      std::panic::catch_unwind\n   
          at src\\libstd/panic.rs:394\n      std::rt::lang_start_internal\n             at src\\libstd/rt.rs:51\n  36: main\n  37: _tmainCRTStartup\n  38: mainCRTStartup\n  39: sqlite3GenerateConstraintChecks\n  40: sqlite3GenerateConstraintChecks\n"} +0ms      
  IntrospectionEngine:rpc SENDING RPC CALL {"id":2,"jsonrpc":"2.0","method":"getDatabaseDescription","params":[{"schema":"// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\ndatasource db {\n  provider = \"sqlite\"\n  url      = \"sqlite:./../1093.db\"\n}\n\ngenerator client {\n  provider = \"prisma-client-js\"\n}\n"}]} +92ms
Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
    at doWrite (_stream_writable.js:413:19)
    at writeOrBuffer (_stream_writable.js:401:5)
    at Socket.Writable.write (_stream_writable.js:301:11)
    at C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\build\index.js:2:884310
    at new Promise (<anonymous>)
    at IntrospectionEngine.<anonymous> (C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\build\index.js:2:883015)
    at Generator.next (<anonymous>)
    at fulfilled (C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\build\index.js:2:877318)
    at processTicksAndRejections (internal/process/task_queues.js:85:5)
  IntrospectionEngine:stdin Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed
  IntrospectionEngine:stdin     at doWrite (_stream_writable.js:413:19)
  IntrospectionEngine:stdin     at writeOrBuffer (_stream_writable.js:401:5)
  IntrospectionEngine:stdin     at Socket.Writable.write (_stream_writable.js:301:11)
  IntrospectionEngine:stdin     at C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\build\index.js:2:884310
  IntrospectionEngine:stdin     at new Promise (<anonymous>)
  IntrospectionEngine:stdin     at IntrospectionEngine.<anonymous> (C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\build\index.js:2:883015)
  IntrospectionEngine:stdin     at Generator.next (<anonymous>)
  IntrospectionEngine:stdin     at fulfilled (C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\build\index.js:2:877318)
  IntrospectionEngine:stdin     at processTicksAndRejections (internal/process/task_queues.js:85:5) +0ms
 ERROR  Oops, an unexpected error occured!
[src\libcore\option.rs:1188:5] to

(preview 22 on Windows, but Harshit could reproduce on other platform)

@Jolg42
Copy link
Contributor

Jolg42 commented Feb 28, 2020

I can reproduce Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed

It looks like the error is from the introspection engine, here is the SQL for this database from sqlite3 prisma/1093.db .dump > 1093.sql

When I create a new sqlite database from this .sql I get the same error.

PRAGMA foreign_keys=OFF;
BEGIN TRANSACTION;
CREATE TABLE IF NOT EXISTS "Group"
(
	id integer not null
		primary key autoincrement,
	name varchar(255)
);
CREATE TABLE User
(
	id integer not null
		primary key autoincrement,
	email varchar(255) not null,
	password varchar(255) not null,
	created_at datetime,
	updated_at datetime
);
CREATE TABLE GroupToUser
(
	user_id integer
		references User,
	group_id integer
		references "Group"
);
DELETE FROM sqlite_sequence;
COMMIT;

@janpio
Copy link
Contributor Author

janpio commented Feb 28, 2020

I think "Error [ERR_STREAM_DESTROYED]: Cannot call write after a stream was destroyed" is a follow up error when the Engine crashes. We might want to handle that better - you have a nice reproduction here ;)

@Jolg42

This comment has been minimized.

@Jolg42
Copy link
Contributor

Jolg42 commented Mar 18, 2020

The output changed on alpha 927, I see "libs/sql-schema-describer/src/sqlite.rs:309:37" that wasn't there before.

env DEBUG="*" npx prisma2@alpha introspect > test2.log
  getos { platform: 'darwin', libssl: undefined } +0ms
  download {
  download   cachedFile: '/Users/j42/.cache/prisma/master/a50009b3729b0c9187c88c8cf6cebd268881c9bb/darwin/query-engine'
  download } +0ms
  download {
  download   cachedFile: '/Users/j42/.cache/prisma/master/a50009b3729b0c9187c88c8cf6cebd268881c9bb/darwin/migration-engine'
  download } +0ms
  download {
  download   cachedFile: '/Users/j42/.cache/prisma/master/a50009b3729b0c9187c88c8cf6cebd268881c9bb/darwin/introspection-engine'
  download } +1ms
  download { needsToBeDownloaded: false } +33ms
  download { needsToBeDownloaded: false } +8ms
  download { needsToBeDownloaded: false } +3ms
  prisma2:download Error: ENOENT: no such file or directory, unlink '/Users/j42/.npm/_npx/1060/lib/node_modules/prisma2/download-lock'
  prisma2:download     at Object.unlinkSync (fs.js:1035:3)
  prisma2:download     at cleanupLockFile (/Users/j42/.npm/_npx/1060/lib/node_modules/prisma2/download-build/index.js:1:73091)
  prisma2:download     at process.<anonymous> (/Users/j42/.npm/_npx/1060/lib/node_modules/prisma2/download-build/index.js:1:74109)
  prisma2:download     at process.emit (events.js:223:5) +0ms
  prisma .env not loaded +0ms
  getos { platform: 'darwin', libssl: undefined } +0ms
  download {
  download   cachedFile: '/Users/j42/.cache/prisma/master/a50009b3729b0c9187c88c8cf6cebd268881c9bb/darwin/query-engine'
  download } +0ms
  download {
  download   cachedFile: '/Users/j42/.cache/prisma/master/a50009b3729b0c9187c88c8cf6cebd268881c9bb/darwin/migration-engine'
  download } +1ms
  download {
  download   cachedFile: '/Users/j42/.cache/prisma/master/a50009b3729b0c9187c88c8cf6cebd268881c9bb/darwin/introspection-engine'
  download } +0ms
  download { cachedFileSize: 16390640, targetFileSize: 16390640 } +0ms
  download { cachedFileSize: 14694784, targetFileSize: 14694784 } +6ms
  download { cachedFileSize: 11045144, targetFileSize: 11045144 } +3ms
  download Getting version of /Users/j42/.npm/_npx/1060/lib/node_modules/prisma2/query-engine-darwin. Result:  {
  command: '/Users/j42/.npm/_npx/1060/lib/node_modules/prisma2/query-engine-darwin --version',
  exitCode: 0,
  stdout: 'prisma a50009b3729b0c9187c88c8cf6cebd268881c9bb',
  stderr: '',
  all: undefined,
  failed: false,
  timedOut: false,
  isCanceled: false,
  killed: false
} +201ms
  download Getting version of /Users/j42/.npm/_npx/1060/lib/node_modules/prisma2/query-engine-darwin. Result:  prisma a50009b3729b0c9187c88c8cf6cebd268881c9bb +0ms
  download { works: true } +0ms
  download { needsToBeDownloaded: false } +0ms
  download Getting version of /Users/j42/.npm/_npx/1060/lib/node_modules/prisma2/migration-engine-darwin. Result:  {
  command: '/Users/j42/.npm/_npx/1060/lib/node_modules/prisma2/migration-engine-darwin --version',
  exitCode: 0,
  stdout: 'migration-engine-cli a50009b3729b0c9187c88c8cf6cebd268881c9bb',
  stderr: '',
  all: undefined,
  failed: false,
  timedOut: false,
  isCanceled: false,
  killed: false
} +125ms
  download Getting version of /Users/j42/.npm/_npx/1060/lib/node_modules/prisma2/migration-engine-darwin. Result:  migration-engine-cli a50009b3729b0c9187c88c8cf6cebd268881c9bb +0ms
  download { works: true } +1ms
  download { needsToBeDownloaded: false } +0ms
  download Getting version of /Users/j42/.npm/_npx/1060/lib/node_modules/prisma2/introspection-engine-darwin. Result:  {
  command: '/Users/j42/.npm/_npx/1060/lib/node_modules/prisma2/introspection-engine-darwin --version',
  exitCode: 0,
  stdout: 'introspection-core a50009b3729b0c9187c88c8cf6cebd268881c9bb',
  stderr: '',
  all: undefined,
  failed: false,
  timedOut: false,
  isCanceled: false,
  killed: false
} +159ms
  download Getting version of /Users/j42/.npm/_npx/1060/lib/node_modules/prisma2/introspection-engine-darwin. Result:  introspection-core a50009b3729b0c9187c88c8cf6cebd268881c9bb +0ms
  download { works: true } +0ms
  download { needsToBeDownloaded: false } +0ms
  getos { platform: 'darwin', libssl: undefined } +502ms
  IntrospectionEngine:rpc starting introspection engine with binary: /Users/j42/.npm/_npx/1060/lib/node_modules/prisma2/introspection-engine-darwin +0ms
  IntrospectionEngine:rpc SENDING RPC CALL {"id":1,"jsonrpc":"2.0","method":"introspect","params":[{"schema":"datasource db {\n    provider = \"sqlite\"\n    url      = \"sqlite:./1093.db\"\n    // url      = \"sqlite:./1093import.db\"\n    // url      = \"sqlite:./1233.db\"\n}\n\ngenerator client {\n    provider = \"prisma-client-js\"\n}"}]} +4ms
  IntrospectionEngine:stderr {"is_panic":true,"message":"[libs/sql-schema-describer/src/sqlite.rs:309:37] to","backtrace":"   0: backtrace::backtrace::trace\n   1: backtrace::capture::Backtrace::new\n   2: user_facing_errors::Error::new_in_panic_hook\n   3: user_facing_errors::panic_hook::set_panic_hook::{{closure}}\n   4: std::panicking::rust_panic_with_hook\n   5: rust_begin_unwind\n   6: core::panicking::panic_fmt\n   7: core::option::expect_failed\n   8: sql_schema_describer::sqlite::SqlSchemaDescriber::get_table::{{closure}}\n   9: <std::future::GenFuture<T> as core::future::future::Future>::poll\n  10: std::future::poll_with_tls_context\n  11: <std::future::GenFuture<T> as core::future::future::Future>::poll\n  12: <std::future::GenFuture<T> as core::future::future::Future>::poll\n  13: <futures_util::compat::compat03as01::Compat<Fut> as futures::future::Future>::poll\n  14: <futures::future::map::Map<A,F> as futures::future::Future>::poll\n  15: <futures::future::map_err::MapErr<A,F> as futures::future::Future>::poll\n  16: <futures::future::either::Either<A,B> as futures::future::Future>::poll\n  17: <futures::future::lazy::Lazy<F,R> as futures::future::Future>::poll\n  18: futures::future::chain::Chain<A,B,C>::poll\n  19: <futures::future::then::Then<A,B,F> as futures::future::Future>::poll\n  20: <futures::future::map::Map<A,F> as futures::future::Future>::poll\n  21: <futures::future::either::Either<A,B> as futures::future::Future>::poll\n  22: <futures::future::map::Map<A,F> as futures::future::Future>::poll\n  23: futures::task_impl::std::set\n  24: <std::future::GenFuture<T> as core::future::future::Future>::poll\n  25: tokio::runtime::enter::Enter::block_on\n  26: tokio::runtime::context::enter\n  27: tokio::runtime::handle::Handle::enter\n  28: introspection_engine::main\n  29: std::rt::lang_start::{{closure}}\n  30: std::panicking::try::do_call\n  31: __rust_maybe_catch_panic\n  32: std::rt::lang_start_internal\n  33: main\n"} +0ms
Error: Error: [libs/sql-schema-describer/src/sqlite.rs:309:37] to
    at ChildProcess.<anonymous> (/Users/j42/.npm/_npx/1060/lib/node_modules/prisma2/build/index.js:2:1297485)
    at ChildProcess.emit (events.js:223:5)
    at ChildProcess.EventEmitter.emit (domain.js:475:20)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
  prisma Error: Can't execute {"id":2,"jsonrpc":"2.0","method":"getDatabaseDescription","params":[{"schema":"datasource db {\n    provider = \"sqlite\"\n    url      = \"sqlite:./1093.db\"\n    // url      = \"sqlite:./1093import.db\"\n    // url      = \"sqlite:./1233.db\"\n}\n\ngenerator client {\n    provider = \"prisma-client-js\"\n}"}]} because introspection engine is destroyed.
  prisma     at /Users/j42/.npm/_npx/1060/lib/node_modules/prisma2/build/index.js:2:1300056
  prisma     at new Promise (<anonymous>)
  prisma     at IntrospectionEngine.<anonymous> (/Users/j42/.npm/_npx/1060/lib/node_modules/prisma2/build/index.js:2:1298790)
  prisma     at Generator.next (<anonymous>)
  prisma     at fulfilled (/Users/j42/.npm/_npx/1060/lib/node_modules/prisma2/build/index.js:2:1293093)
  prisma     at processTicksAndRejections (internal/process/task_queues.js:94:5) +550ms

@janpio

This comment has been minimized.

@Jolg42

This comment has been minimized.

@janpio
Copy link
Contributor Author

janpio commented Mar 19, 2020

Introspecting the SQL from #1648 (comment) I now got an error prompt:

https://prisma-errors.netlify.com/report/2289

With DEBUG=* I get this output now:

C:\Users\Jan\Documents\throwaway\1648>prisma2 introspect
  prisma .env loaded from ./prisma/.env +0ms
  getos { platform: 'win32', libssl: undefined } +0ms
  download Getting version of C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\query-engine-windows.exe. Result:  {
  command: 'C:\\ProgramData\\nvm\\v12.6.0\\node_modules\\prisma2\\query-engine-windows.exe --version',
  exitCode: 0,
  stdout: 'prisma 00c64c12cd73d8943c479d708b3a73003d611413',
  stderr: '',
  all: undefined,
  failed: false,
  timedOut: false,
  isCanceled: false,
  killed: false
} +0ms
  download Getting version of C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\query-engine-windows.exe. Result:  prisma 00c64c12cd73d8943c479d708b3a73003d611413 +5ms
  download { works: true } +1ms
  download { needsToBeDownloaded: false } +0ms
  download Getting version of C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\migration-engine-windows.exe. Result:  {
  command: 'C:\\ProgramData\\nvm\\v12.6.0\\node_modules\\prisma2\\migration-engine-windows.exe --version',
  exitCode: 0,
  stdout: 'migration-engine-cli 00c64c12cd73d8943c479d708b3a73003d611413',
  stderr: '',
  all: undefined,
  failed: false,
  timedOut: false,
  isCanceled: false,
  killed: false
} +5ms
  download Getting version of C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\migration-engine-windows.exe. Result:  migration-engine-cli 00c64c12cd73d8943c479d708b3a73003d611413 +25ms
  download { works: true } +1ms
  download { needsToBeDownloaded: false } +1ms
  download Getting version of C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\introspection-engine-windows.exe. Result:  {
  command: 'C:\\ProgramData\\nvm\\v12.6.0\\node_modules\\prisma2\\introspection-engine-windows.exe --version',
  exitCode: 0,
  stdout: 'introspection-core 00c64c12cd73d8943c479d708b3a73003d611413',
  stderr: '',
  all: undefined,
  failed: false,
  timedOut: false,
  isCanceled: false,
  killed: false
} +2ms
  download Getting version of C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\introspection-engine-windows.exe. Result:  introspection-core 00c64c12cd73d8943c479d708b3a73003d611413 +4ms 
  download { works: true } +1ms
  download { needsToBeDownloaded: false } +0ms
Introspecting based on datasource defined in prisma\schema.prisma …
  getos { platform: 'win32', libssl: undefined } +167ms
  IntrospectionEngine:rpc starting introspection engine with binary: C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\introspection-engine-windows.exe +0ms
  IntrospectionEngine:rpc SENDING RPC CALL {"id":1,"jsonrpc":"2.0","method":"introspect","params":[{"schema":"// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\ndatasource db {\n  provider = \"sqlite\"\n  url      = \"file:dev.db\"\n}\n\ngenerator client {\n  provider = \"prisma-client-js\"\n}\n"}]} +7ms
  IntrospectionEngine:stderr {"is_panic":true,"message":"[libs/sql-schema-describer/src/sqlite.rs:309:37] to","backtrace":"   0: backtrace::backtrace::trace\n   1: backtrace::capture::Backtrace::new\n   2: user_facing_errors::Error::new_in_panic_hook\n   3: user_facing_errors::panic_hook::set_panic_hook::{{closure}}\n   4: std::panicking::rust_panic_with_hook\n
    at src\\libstd/panicking.rs:476\n   5: rust_begin_unwind\n             at src\\libstd/panicking.rs:380\n   6: core::panicking::panic_fmt\n             at src\\libcore/panicking.rs:85\n   7: core::option::expect_failed\n             at src\\libcore/option.rs:1191\n   8: sql_schema_describer::sqlite::SqlSchemaDescriber::get_table::{{closure}}\n   9: <std::future::GenFuture<T> as core::future::future::Future>::poll\n  10: std::future::poll_with_tls_context\n  11: <std::future::GenFuture<T> as core::future::future::Future>::poll\n  12: <std::future::GenFuture<T> as core::future::future::Future>::poll\n  13: <futures_util::compat::compat03as01::Compat<Fut> as futures::future::Future>::poll\n  14: <futures::future::map::Map<A,F> as futures::future::Future>::poll\n  15: <futures::future::map_err::MapErr<A,F> as futures::future::Future>::poll\n  16: <futures::future::either::Either<A,B> as futures::future::Future>::poll\n  17: <futures::future::lazy::Lazy<F,R> as futures::future::Future>::poll\n  18: futures::future::chain::Chain<A,B,C>::poll\n  19: <futures::future::then::Then<A,B,F> as futures::future::Future>::poll\n  20: <futures::future::either::Either<A,B> as futures::future::Future>::poll\n  21: <futures::future::map::Map<A,F> as futures::future::Future>::poll\n  22: <futures::future::either::Either<A,B> as futures::future::Future>::poll\n  23: <futures::future::map::Map<A,F> as futures::future::Future>::poll\n  24: futures::task_impl::std::set\n  25: <futures_util::compat::compat01as03::Compat01As03<Fut> as core::future::future::Future>::poll\n  26: <std::future::GenFuture<T> as core::future::future::Future>::poll\n  27: tokio::runtime::enter::Enter::block_on\n  28: tokio::runtime::context::enter\n  29: tokio::runtime::Runtime::block_on\n  30: introspection_engine::main\n  31: std::rt::lang_start::{{closure}}\n  32: std::rt::lang_start_internal::{{closure}}\n             at src\\libstd/rt.rs:52\n      std::panicking::try::do_call\n             at src\\libstd/panicking.rs:305\n  33: __rust_maybe_catch_panic\n             at src\\libpanic_unwind/lib.rs:86\n  34: std::panicking::try\n             at src\\libstd/panicking.rs:281\n      std::panic::catch_unwind\n             at src\\libstd/panic.rs:394\n      std::rt::lang_start_internal\n             at src\\libstd/rt.rs:51\n  35: main\n  36: _tmainCRTStartup\n  37: mainCRTStartup\n  38: sqlite3GenerateConstraintChecks\n  39: sqlite3GenerateConstraintChecks\n"} +0ms
 ERROR  Oops, an unexpected error occured!
Please help us improve Prisma 2 by submitting an error report.
Error reports never contain personal or other sensitive information.
Learn more: https://pris.ly/d/telemetry

┌─ Submit error report ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐  
│                                                                                                                                                                                      │  
│ > Yes            Send error report once                                                                                                                                              │  
│   No             Don't send error report                                                                                                                                             │  
│                                                                                                                                                                                      │  
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘  
 ERROR  Oops, an unexpected error occured!
Please help us improve Prisma 2 by submitting an error report.
Error reports never contain personal or other sensitive information.
Learn more: https://pris.ly/d/telemetry

┌─ Submit error report ────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┐  
│                                                                                                                                                                                      │  
│   Yes            Send error report once                                                                                                                                              │  
│ > No             Don't send error report                                                                                                                                             │  
│                                                                                                                                                                                      │  
└──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────┘  

Relevant bit:

C:\ProgramData\nvm\v12.6.0\node_modules\prisma2\introspection-engine-windows.exe +0ms
  IntrospectionEngine:rpc SENDING RPC CALL {"id":1,"jsonrpc":"2.0","method":"introspect","params":[{"schema":"// This is your Prisma schema file,\n// learn more about it in the docs: https://pris.ly/d/prisma-schema\n\ndatasource db {\n  provider = \"sqlite\"\n  url      = \"file:dev.db\"\n}\n\ngenerator client {\n  provider = \"prisma-client-js\"\n}\n"}]} +7ms
  IntrospectionEngine:stderr {"is_panic":true,"message":"[libs/sql-schema-describer/src/sqlite.rs:309:37] to","backtrace":"   0: backtrace::backtrace::trace\n   1: backtrace::capture::Backtrace::new\n   2: user_facing_errors::Error::new_in_panic_hook\n   3: user_facing_errors::panic_hook::set_panic_hook::{{closure}}\n   4: std::panicking::rust_panic_with_hook\n
    at src\\libstd/panicking.rs:476\n   5: rust_begin_unwind\n             at src\\libstd/panicking.rs:380\n   6: core::panicking::panic_fmt\n             at src\\libcore/panicking.rs:85\n   7: core::option::expect_failed\n             at src\\libcore/option.rs:1191\n   8: sql_schema_describer::sqlite::SqlSchemaDescriber::get_table::{{closure}}\n   9: <std::future::GenFuture<T> as core::future::future::Future>::poll\n  10: std::future::poll_with_tls_context\n  11: <std::future::GenFuture<T> as core::future::future::Future>::poll\n  12: <std::future::GenFuture<T> as core::future::future::Future>::poll\n  13: <futures_util::compat::compat03as01::Compat<Fut> as futures::future::Future>::poll\n  14: <futures::future::map::Map<A,F> as futures::future::Future>::poll\n  15: <futures::future::map_err::MapErr<A,F> as futures::future::Future>::poll\n  16: <futures::future::either::Either<A,B> as futures::future::Future>::poll\n  17: <futures::future::lazy::Lazy<F,R> as futures::future::Future>::poll\n  18: futures::future::chain::Chain<A,B,C>::poll\n  19: <futures::future::then::Then<A,B,F> as futures::future::Future>::poll\n  20: <futures::future::either::Either<A,B> as futures::future::Future>::poll\n  21: <futures::future::map::Map<A,F> as futures::future::Future>::poll\n  22: <futures::future::either::Either<A,B> as futures::future::Future>::poll\n  23: <futures::future::map::Map<A,F> as futures::future::Future>::poll\n  24: futures::task_impl::std::set\n  25: <futures_util::compat::compat01as03::Compat01As03<Fut> as core::future::future::Future>::poll\n  26: <std::future::GenFuture<T> as core::future::future::Future>::poll\n  27: tokio::runtime::enter::Enter::block_on\n  28: tokio::runtime::context::enter\n  29: tokio::runtime::Runtime::block_on\n  30: introspection_engine::main\n  31: std::rt::lang_start::{{closure}}\n  32: std::rt::lang_start_internal::{{closure}}\n             at src\\libstd/rt.rs:52\n      std::panicking::try::do_call\n             at src\\libstd/panicking.rs:305\n  33: __rust_maybe_catch_panic\n             at src\\libpanic_unwind/lib.rs:86\n  34: std::panicking::try\n             at src\\libstd/panicking.rs:281\n      std::panic::catch_unwind\n             at src\\libstd/panic.rs:394\n      std::rt::lang_start_internal\n             at src\\libstd/rt.rs:51\n  35: main\n  36: _tmainCRTStartup\n  37: mainCRTStartup\n  38: sqlite3GenerateConstraintChecks\n  39: sqlite3GenerateConstraintChecks\n"} +0ms

(Much better formatted in the error report link above)

@janpio janpio modified the milestones: Preview 25, Foo 1 Mar 26, 2020
@janpio janpio added this to Beta 2 in 👷 Beta Mar 30, 2020
@janpio janpio modified the milestones: Foo 1, Foo 2 Mar 30, 2020
@tomhoule
Copy link
Contributor

tomhoule commented Apr 1, 2020

I haven't managed to get a readable error from the JS cli, but running the introspection engine directly, I get Error: Some(Object({"is_panic": Bool(false), "message": String("The introspected database was empty: sqlite:./../1093.db"), "meta": Object({"connection_string": String("sqlite:./../1093.db")}), "error_code": String("P4001")})) (with the database from the .zip Jan posted in the description), so it looks like this should be reported as a known error?

@janpio
Copy link
Contributor Author

janpio commented Apr 1, 2020

Hm, database is definitely not empty:
image
(Via download and unzip of the link above)

@do4gr
Copy link
Member

do4gr commented Apr 22, 2020

This was caused by a shortcut in the Sqlite foreign key definition btw.

They allow you to write:
userid Int References user instead of userid Int References user(id)

Unfortunately the meta information calls then don't automatically provide the Information about the referenced column which caused the crash. This is now being handled.

@do4gr do4gr unassigned tomhoule and do4gr Apr 22, 2020
@Jolg42
Copy link
Contributor

Jolg42 commented Apr 22, 2020

Awesome @do4gr 🚀

@janpio janpio added topic: prisma db pull CLI: prisma db pull and removed topic: prisma introspect labels Feb 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug/2-confirmed Bug has been reproduced and confirmed. kind/bug A reported bug. tech/engines Issue for tech Engines. topic: introspection topic: prisma db pull CLI: prisma db pull
Projects
No open projects
Development

Successfully merging a pull request may close this issue.

6 participants