We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
With a Postgresql backend, Photon panics into a query error if using @id of type String @default(uuid())
Error: Error in Photon: ConnectorError(QueryError(Error { kind: ToSql(0), cause: Some(WrongType(Type(Text))) } stack backtrace: 0: backtrace::backtrace::trace::h5511721bea6fa8d5 (0x10928ea2e) 1: backtrace::capture::Backtrace::new_unresolved::h28f9c9663a9420c8 (0x10928db88) 2: failure::backtrace::internal::InternalBacktrace::new::hbb41405b6d19ab81 (0x10928d4f9) 3: <failure::backtrace::Backtrace as core::default::Default>::default::h0458ad281d4247c8 (0x10928d6e5) 4: <sql_connector::error::SqlError as core::convert::From<tokio_postgres::error::Error>>::from::h4d6632d810ab6f89 (0x108bb7e9c) 5: sql_connector::database::postgresql::<impl sql_connector::transactional::Transaction for postgres::transaction::Transaction>::write::ha2ca1483a41de8e3 (0x108b8df99) 6: sql_connector::transactional::Transaction::insert::h102a04439344ffff (0x10879e924) 7: sql_connector::transactional::database_writer::create::execute::h2c63144580998c8d (0x108bcc331) 8: sql_connector::transactional::database_writer::<impl connector::database_writer::DatabaseWriter for sql_connector::database::SqlDatabase<T>>::execute::{{closure}}::create::hef864a06474fbea9 (0x108c09b47) 9: <sql_connector::database::postgresql::PostgreSql as sql_connector::transactional::Transactional>::with_transaction::h9fe1ec452d2d39e2 (0x10889bd98) 10: sql_connector::transactional::database_writer::<impl connector::database_writer::DatabaseWriter for sql_connector::database::SqlDatabase<T>>::execute::h292b3294dffefd85 (0x108820496) 11: core::executor::write::WriteQueryExecutor::exec_one::h48f2e807cc785823 (0x108cba146) 12: core::executor::write::WriteQueryExecutor::execute::h992b6a51be508cce (0x108cb9a9b) 13: core::executor::Executor::exec_all::h5cbc538ae21b3c80 (0x108cd8be4) 14: <prisma::req_handlers::graphql::GraphQlRequestHandler as prisma::req_handlers::RequestHandler>::handle::h7d76032243e11158 (0x108920b3f) 15: prisma::http_handler::h5782a9905407eb5f (0x1088bb4cf) 16: <F as actix_web::with::FnWith<T,R>>::call_with::haa4a1a2255bc8611 (0x1089187d3) 17: <actix_web::with::WithHandlerFut<T,S,R> as futures::future::Future>::poll::hd3a8444797502a6e (0x10891eb52) 18: actix_web::pipeline::PipelineState<S,H>::poll::h147d5d5368789f0e (0x1087f8c46) 19: <actix_web::pipeline::Pipeline<S,H> as actix_web::server::handler::HttpHandlerTask>::poll_io::h39e2cc76fc5e8dd4 (0x1087ec110) 20: actix_web::server::h1::Http1Dispatcher<T,H>::poll_handler::hf7d43112cc4ed6f5 (0x1087c1f4a) 21: actix_web::server::h1::Http1Dispatcher<T,H>::poll::h9c1da5bf8f5108dd (0x1088911a3) 22: <actix_web::server::channel::HttpChannel<T,H> as futures::future::Future>::poll::had9f1b0a81e71dda (0x108890079) 23: <actix_web::server::channel::HttpChannel<T,H> as futures::future::Future>::poll::had9f1b0a81e71dda (0x108890f33) 24: <actix_net::service::and_then::AndThenFuture<A,B> as futures::future::Future>::poll::h15ac475c98adc942 (0x1087eaa06) 25: futures::future::chain::Chain<A,B,C>::poll::hb6e62549216884f5 (0x1087e6c84) 26: futures::task_impl::std::set::he4a7d579f87ab972 (0x108a026fd) 27: futures::task_impl::Spawn<T>::poll_future_notify::h1a5228822adb903e (0x108a1b70f) 28: tokio_current_thread::CurrentRunner::set_spawn::h6965d5b16e375442 (0x1089fc674) 29: tokio_current_thread::scheduler::Scheduler<U>::tick::h6c1934358ae3f6a8 (0x108a08a05) 30: tokio_current_thread::Entered<P>::block_on::he3da6e046995d1e4 (0x1089fd22a) 31: std::thread::local::LocalKey<T>::with::h6ed9ac0420a84d3b (0x108a13904) 32: std::thread::local::LocalKey<T>::with::h71f7d0c12da0393f (0x108a13e47) 33: std::thread::local::LocalKey<T>::with::h10c82d1197b9368d (0x108a11b2c) 34: std::thread::local::LocalKey<T>::with::h38bd3e3c53efd4ea (0x108a13008) 35: tokio::runtime::current_thread::runtime::Runtime::block_on::hbad87c088a1c5a72 (0x108a00a92) 36: std::sys_common::backtrace::__rust_begin_short_backtrace::h690508ce542785d7 (0x108a192a8) 37: std::panicking::try::do_call::h1536644c0a3cab79 (0x1089fedfb) 38: __rust_maybe_catch_panic (0x1092bf51f) 39: core::ops::function::FnOnce::call_once{{vtable.shim}}::h3508efbc713fc3ba (0x108a19b36) 40: <alloc::boxed::Box<F> as core::ops::function::FnOnce<A>>::call_once::hf8766009c029bc09 (0x1092a671e) 41: std::sys::unix::thread::Thread::new::thread_start::hfdef4649a42cf26c (0x1092beb1e) 42: _pthread_body (0x7fff7c6e4305) 43: _pthread_start (0x7fff7c6e726f))) at PhotonFetcher.<anonymous> (project/node_modules/@generated/photon/index.js:33:23) at Generator.throw (<anonymous>) at rejected (project/node_modules/@generated/photon/index.js:5:65) at process._tickCallback (internal/process/next_tick.js:68:7)
The datamodel is as below:
datasource db { provider = "postgres" url = "postgresql://prisma:prisma@localhost:5432/postgres?schema=public" } generator photon { provider = "photonjs" } model User { id String @id @default(uuid()) @unique createdAt DateTime @default(now()) updatedAt DateTime @updatedAt name String @unique password String }
The backend is a clean dockerized Postgres. The Typescript file for seeding the database and produce the error reported:
import Photon from "@generated/photon"; const photon = new Photon(); async function main() { const user1 = await photon.users.create({ data: { name: "username", password: "password" } }); console.log({ user1 }); } main() .catch(e => console.error(e)) .finally(async () => { await photon.disconnect(); });
Using cuid instead of uuid solves the error:
id String @id @default(cuid()) @unique
The text was updated successfully, but these errors were encountered:
I am able to reproduce this, error log is in reproduction readme https://github.com/divyenduz/p2_197
Sorry, something went wrong.
A fix for this is available in alpha.
alpha
mavilein
No branches or pull requests
With a Postgresql backend, Photon panics into a query error if using @id of type String @default(uuid())
The datamodel is as below:
The backend is a clean dockerized Postgres. The Typescript file for seeding the database and produce the error reported:
Using cuid instead of uuid solves the error:
The text was updated successfully, but these errors were encountered: