`npx prisma introspect` errors with `[libs/sql-schema-describer/src/mysql.rs:353:27] column_name` on indexes using expressions (MySQL 8.0.13+)
See original GitHub issueBug description
Getting the following error when running npx prisma introspect
$ DEBUG="*" npx prisma introspect
Environment variables loaded from prisma/.env
Introspecting based on datasource defined in prisma/schema.prisma …
IntrospectionEngine:rpc starting introspection engine with binary: projectFolder/node_modules/@prisma/cli/introspection-engine-darwin +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 = \"mysql\"\n url = env(\"DATABASE_URL\")\n}\n\ngenerator client {\n provider = \"prisma-client-js\"\n}\n"}]} +8ms
IntrospectionEngine:stderr {"is_panic":true,"message":"[libs/sql-schema-describer/src/mysql.rs:353:27] column_name","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::mysql::SqlSchemaDescriber as sql_schema_describer::SqlSchemaDescriberBackend>::describe::__describe::{{closure}}\n 9: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll\n 10: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll\n 11: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll\n 12: <core::future::from_generator::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::either::Either<A,B> as futures::future::Future>::poll\n 16: futures::future::chain::Chain<A,B,C>::poll\n 17: <futures::future::then::Then<A,B,F> as futures::future::Future>::poll\n 18: <futures::future::map::Map<A,F> as futures::future::Future>::poll\n 19: <futures::future::either::Either<A,B> as futures::future::Future>::poll\n 20: <futures::future::map::Map<A,F> as futures::future::Future>::poll\n 21: futures::task_impl::std::set\n 22: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll\n 23: tokio::runtime::enter::Enter::block_on\n 24: tokio::runtime::context::enter\n 25: tokio::runtime::handle::Handle::enter\n 26: introspection_engine::main\n 27: std::rt::lang_start::{{closure}}\n 28: std::rt::lang_start_internal\n 29: _main\n"} +0ms
The above error occurred in the <TabIndexProvider> component:
in TabIndexProvider
in App
React will try to recreate this component tree from scratch using the error boundary you provided, App.
Warning: App: Error boundaries should implement getDerivedStateFromError(). In that method, return a state update to display an error message or fallback UI.
prisma TypeError: Cannot read property 'Symbol(keypress-decoder)' of undefined
prisma at Object.emitKeypressEvents (readline.js:1104:13)
prisma at Object.useStdin (projectFolder/node_modules/@prisma/cli/build/index.js:2:2913327)
prisma at TabIndexProvider (projectFolder/node_modules/@prisma/cli/build/index.js:2:2313126)
prisma at renderWithHooks (projectFolder/node_modules/@prisma/cli/build/index.js:2:2706893)
prisma at mountIndeterminateComponent (projectFolder/node_modules/@prisma/cli/build/index.js:2:2736840)
prisma at beginWork$1 (projectFolder/node_modules/@prisma/cli/build/index.js:2:2752820)
prisma at Object._s (projectFolder/node_modules/@prisma/cli/build/index.js:2:2767616)
prisma at invokeGuardedCallback (projectFolder/node_modules/@prisma/cli/build/index.js:2:2770115)
prisma at Ou (projectFolder/node_modules/@prisma/cli/build/index.js:2:2812237)
prisma at performUnitOfWork (projectFolder/node_modules/@prisma/cli/build/index.js:2:2801113) +0ms
How to reproduce
Was following the guide: https://www.prisma.io/docs/getting-started/setup-prisma/add-to-existing-project-typescript-mysql
got to the to the point where it ask to run npx prisma introspect
Expected behavior
No error to occur 😃
Prisma information
Environment & setup
- OS: MAC OS Catalina
- Database: MySQL 8
- Prisma version: 2.2.2
- Node.js version: 12.18.2
Issue Analytics
- State:
- Created 3 years ago
- Comments:12 (8 by maintainers)
Top Results From Across the Web
Introspection | node-mysql - Prisma
Introspection your database with Prisma. ... For the purpose of this guide, we'll use a demo SQL schema with three tables: CREATE TABLE...
Read more >Indexes - Prisma
Prisma allows configuration of database indexes, unique constraints and primary key constraints. This is in General Availability in versions 4.0.0 and later ...
Read more >Prisma schema API (Reference)
API reference documentation for the Prisma Schema Language (PSL).
Read more >Data model (Reference) - Prisma
Learn about the concepts for building your data model with Prisma: Models, scalar types, enums, attributes, functions, IDs, default values and more.
Read more >Improving Query Performance with Indexes using Prisma
Database providers, such as PostgreSQL and MySQL, have different implementations of the B-tree which are a little more intricate. When to use a ......
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
@janpio
Those index use Expressions as part of defining the index. This is new as of MySQL 8.0.13 https://dev.mysql.com/doc/refman/8.0/en/create-index.html#create-index-unique
This is an example of the index that was created in my database
Those columns that are expressions, show up as NULL column_names
Making it not crash by just not including the index for now should be a straightforward fix. I’ll have a look.