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

Unix socket connection not working #525

Closed
malekjaroslav opened this issue Sep 9, 2019 · 42 comments
Closed

Unix socket connection not working #525

malekjaroslav opened this issue Sep 9, 2019 · 42 comments
Assignees
Milestone

Comments

@malekjaroslav
Copy link

malekjaroslav commented Sep 9, 2019

Tried all possibilities of connections strings to the DB but still unsuccessful deploying to Google Cloud (App Engine/Cloud Run). Connection strings are replaced with placeholders for security.

Step #1 - "builder": $ DEBUG=* RUST_BACKTRACE=full yarn lift:up && yarn build
Step #1 - "builder": $ prisma2 lift up
Step #1 - "builder": info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Step #1 - "builder": info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Step #1 - "builder":
Step #1 - "builder": INFO `yarn_run_gcp_build` had stderr output:
Step #1 - "builder": 2019-09-09T11:44:30.680Z LiftEngine:rpc SENDING RPC CALL { id: 1,
Step #1 - "builder": jsonrpc: '2.0',
Step #1 - "builder": method: 'listMigrations',
Step #1 - "builder": params:
Step #1 - "builder": { projectInfo: '',
Step #1 - "builder": sourceConfig:
Step #1 - "builder": 'datasource db {\n provider = "postgresql"\n url = "postgresql://<usr>:<pass>@<ip>/<db>?schema=public"\n}\n\ngenerator photon {\n provider = "photonjs"\n}\n\ngenerator nexus_prisma {\n provider = "nexus-prisma"\n}\n\nmodel File {\n id String @id @default(cuid())\n name String\n project Project\n url String\n type String\n}\n\nmodel User {\n id String @id @default(cuid())\n authId String @unique\n email String @unique\n projects Project[]\n name String\n profileImg String?\n postVersions PostVersion[]\n faqs Faq[]\n}\n\nmodel Company {\n id String @id @default(cuid())\n name String\n projects Project[]\n}\n\nmodel Project {\n id String @id @default(cuid())\n name String\n company Company\n webUrl String?\n logo String\n logoSmall String\n postCategories PostCategory[]\n faqCategories FaqCategory[]\n posts PostVersion[]\n faqs Faq[]\n admins User[]\n files File[]\n}\n\nmodel Post {\n id String @id @default(cuid())\n draftedVersion PostVersion @relation(name: "draft")\n publishedVersion PostVersion @relation(name: "published")\n}\n\nmodel PostVersion {\n id String @id @default(cuid())\n draftedPost Post? @relation(name: "draft")\n publishedPost Post? @relation(name: "published")\n title String\n text String\n language String\n categories PostCategory[]\n author User\n published Boolean\n project Project\n ogTitle String?\n ogDescription String?\n createdAt DateTime\n updatedAt DateTime @updatedAt\n}\n\nmodel Faq {\n id String @id @default(cuid())\n question String\n answer String\n category FaqCategory?\n published Boolean\n language String\n project Project\n author User\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel PostCategory {\n id String @id @default(cuid())\n name String\n project Project\n posts PostVersion[]\n}\n\nmodel FaqCategory {\n id String @id @default(cuid())\n name String\n project Project\n faqs Faq[]\n}' } }
Step #1 - "builder": 2019-09-09T11:44:33.703Z LiftEngine:stderr thread 'main' panicked at 'Box<Any>', migration-engine/core/src/main.rs:55:23
Step #1 - "builder": 2019-09-09T11:44:33.703Z LiftEngine:stderr stack backtrace:
Step #1 - "builder": 2019-09-09T11:44:33.730Z LiftEngine:stderr 0: backtrace::backtrace::libunwind::trace
Step #1 - "builder": 2019-09-09T11:44:33.730Z LiftEngine:stderr at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
Step #1 - "builder": 2019-09-09T11:44:33.731Z LiftEngine:stderr 1: backtrace::backtrace::trace_unsynchronized
Step #1 - "builder": 2019-09-09T11:44:33.731Z LiftEngine:stderr at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66
Step #1 - "builder": 2019-09-09T11:44:33.732Z LiftEngine:stderr 2: std::sys_common::backtrace::_print
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr at src/libstd/sys_common/backtrace.rs:47
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 3: std::sys_common::backtrace::print
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr at src/libstd/sys_common/backtrace.rs:36
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 4: std::panicking::default_hook::{{closure}}
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr at src/libstd/panicking.rs:200
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 5: std::panicking::default_hook
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr at src/libstd/panicking.rs:214
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 6: std::panicking::rust_panic_with_hook
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr at src/libstd/panicking.rs:477
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 7: std::panicking::begin_panic
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 8: migration_engine::main
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 9: std::rt::lang_start::{{closure}}
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 10: std::rt::lang_start_internal::{{closure}}
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr at src/libstd/rt.rs:49
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 11: std::panicking::try::do_call
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr at src/libstd/panicking.rs:296
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr 12: __rust_maybe_catch_panic
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr at src/libpanic_unwind/lib.rs:82
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr 13: std::panicking::try
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr at src/libstd/panicking.rs:275
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr 14: std::panic::catch_unwind
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr at src/libstd/panic.rs:394
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr 15: std::rt::lang_start_internal
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr at src/libstd/rt.rs:48
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr 16: main
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr 17: __libc_start_main
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr 18: _start
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Step #1 - "builder": Error: Error: Error in migration engine: thread 'main' panicked at 'Box<Any>', migration-engine/core/src/main.rs:55:23
Step #1 - "builder": stack backtrace:
Step #1 - "builder": 0: backtrace::backtrace::libunwind::trace
Step #1 - "builder": at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
Step #1 - "builder": 1: backtrace::backtrace::trace_unsynchronized
Step #1 - "builder": at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66
Step #1 - "builder": 2: std::sys_common::backtrace::_print
Step #1 - "builder": at src/libstd/sys_common/backtrace.rs:47
Step #1 - "builder": 3: std::sys_common::backtrace::print
Step #1 - "builder": at src/libstd/sys_common/backtrace.rs:36
Step #1 - "builder": 4: std::panicking::default_hook::{{closure}}
Step #1 - "builder": at src/libstd/panicking.rs:200
Step #1 - "builder": 5: std::panicking::default_hook
Step #1 - "builder": at src/libstd/panicking.rs:214
Step #1 - "builder": 6: std::panicking::rust_panic_with_hook
Step #1 - "builder": at src/libstd/panicking.rs:477
Step #1 - "builder": 7: std::panicking::begin_panic
Step #1 - "builder": 8: migration_engine::main
Step #1 - "builder": 9: std::rt::lang_start::{{closure}}
Step #1 - "builder": 10: std::rt::lang_start_internal::{{closure}}
Step #1 - "builder": at src/libstd/rt.rs:49
Step #1 - "builder": 11: std::panicking::try::do_call
Step #1 - "builder": at src/libstd/panicking.rs:296
Step #1 - "builder": 12: __rust_maybe_catch_panic
Step #1 - "builder": at src/libpanic_unwind/lib.rs:82
Step #1 - "builder": 13: std::panicking::try
Step #1 - "builder": at src/libstd/panicking.rs:275
Step #1 - "builder": 14: std::panic::catch_unwind
Step #1 - "builder": at src/libstd/panic.rs:394
Step #1 - "builder": 15: std::rt::lang_start_internal
Step #1 - "builder": at src/libstd/rt.rs:48
Step #1 - "builder": 16: main
Step #1 - "builder": 17: __libc_start_main
Step #1 - "builder": 18: _start
Step #1 - "builder": note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Step #1 - "builder": at ChildProcess.child.on (/workspace/node_modules/prisma2/build/index.js:107250:37)
Step #1 - "builder": at ChildProcess.emit (events.js:198:13)
Step #1 - "builder": at ChildProcess.EventEmitter.emit (domain.js:448:20)
Step #1 - "builder": at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
Step #1 - "builder": error Command failed with exit code 1.
Step #1 - "builder": error Command failed with exit code 1.
Step #1 - "builder":
Step #1 - "builder": ERROR error: `yarn_run_gcp_build` returned code: 1
Step #1 - "builder": INFO yarn_run_gcp_build took 5 seconds
Step #1 - "builder": INFO build process for FTL image took 44 seconds
Step #1 - "builder": INFO full build took 44 seconds
Step #1 - "builder": ERROR `yarn_run_gcp_build` had stderr output:
Step #1 - "builder": 2019-09-09T11:44:30.680Z LiftEngine:rpc SENDING RPC CALL { id: 1,
Step #1 - "builder": jsonrpc: '2.0',
Step #1 - "builder": method: 'listMigrations',
Step #1 - "builder": params:
Step #1 - "builder": { projectInfo: '',
Step #1 - "builder": sourceConfig:
Step #1 - "builder": 'datasource db {\n provider = "postgresql"\n url = "postgresql://<user>:<pass>@<ip>/<db>?schema=public"\n}\n\ngenerator photon {\n provider = "photonjs"\n}\n\ngenerator nexus_prisma {\n provider = "nexus-prisma"\n}\n\nmodel File {\n id String @id @default(cuid())\n name String\n project Project\n url String\n type String\n}\n\nmodel User {\n id String @id @default(cuid())\n authId String @unique\n email String @unique\n projects Project[]\n name String\n profileImg String?\n postVersions PostVersion[]\n faqs Faq[]\n}\n\nmodel Company {\n id String @id @default(cuid())\n name String\n projects Project[]\n}\n\nmodel Project {\n id String @id @default(cuid())\n name String\n company Company\n webUrl String?\n logo String\n logoSmall String\n postCategories PostCategory[]\n faqCategories FaqCategory[]\n posts PostVersion[]\n faqs Faq[]\n admins User[]\n files File[]\n}\n\nmodel Post {\n id String @id @default(cuid())\n draftedVersion PostVersion @relation(name: "draft")\n publishedVersion PostVersion @relation(name: "published")\n}\n\nmodel PostVersion {\n id String @id @default(cuid())\n draftedPost Post? @relation(name: "draft")\n publishedPost Post? @relation(name: "published")\n title String\n text String\n language String\n categories PostCategory[]\n author User\n published Boolean\n project Project\n ogTitle String?\n ogDescription String?\n createdAt DateTime\n updatedAt DateTime @updatedAt\n}\n\nmodel Faq {\n id String @id @default(cuid())\n question String\n answer String\n category FaqCategory?\n published Boolean\n language String\n project Project\n author User\n createdAt DateTime @default(now())\n updatedAt DateTime @updatedAt\n}\n\nmodel PostCategory {\n id String @id @default(cuid())\n name String\n project Project\n posts PostVersion[]\n}\n\nmodel FaqCategory {\n id String @id @default(cuid())\n name String\n project Project\n faqs Faq[]\n}' } }
Step #1 - "builder": 2019-09-09T11:44:33.703Z LiftEngine:stderr thread 'main' panicked at 'Box<Any>', migration-engine/core/src/main.rs:55:23
Step #1 - "builder": 2019-09-09T11:44:33.703Z LiftEngine:stderr stack backtrace:
Step #1 - "builder": 2019-09-09T11:44:33.730Z LiftEngine:stderr 0: backtrace::backtrace::libunwind::trace
Step #1 - "builder": 2019-09-09T11:44:33.730Z LiftEngine:stderr at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
Step #1 - "builder": 2019-09-09T11:44:33.731Z LiftEngine:stderr 1: backtrace::backtrace::trace_unsynchronized
Step #1 - "builder": 2019-09-09T11:44:33.731Z LiftEngine:stderr at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66
Step #1 - "builder": 2019-09-09T11:44:33.732Z LiftEngine:stderr 2: std::sys_common::backtrace::_print
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr at src/libstd/sys_common/backtrace.rs:47
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 3: std::sys_common::backtrace::print
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr at src/libstd/sys_common/backtrace.rs:36
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 4: std::panicking::default_hook::{{closure}}
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr at src/libstd/panicking.rs:200
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 5: std::panicking::default_hook
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr at src/libstd/panicking.rs:214
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 6: std::panicking::rust_panic_with_hook
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr at src/libstd/panicking.rs:477
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 7: std::panicking::begin_panic
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 8: migration_engine::main
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 9: std::rt::lang_start::{{closure}}
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 10: std::rt::lang_start_internal::{{closure}}
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr at src/libstd/rt.rs:49
Step #1 - "builder": 2019-09-09T11:44:33.733Z LiftEngine:stderr 11: std::panicking::try::do_call
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr at src/libstd/panicking.rs:296
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr 12: __rust_maybe_catch_panic
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr at src/libpanic_unwind/lib.rs:82
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr 13: std::panicking::try
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr at src/libstd/panicking.rs:275
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr 14: std::panic::catch_unwind
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr at src/libstd/panic.rs:394
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr 15: std::rt::lang_start_internal
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr at src/libstd/rt.rs:48
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr 16: main
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr 17: __libc_start_main
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr 18: _start
Step #1 - "builder": 2019-09-09T11:44:33.734Z LiftEngine:stderr note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Step #1 - "builder": Error: Error: Error in migration engine: thread 'main' panicked at 'Box<Any>', migration-engine/core/src/main.rs:55:23
Step #1 - "builder": stack backtrace:
Step #1 - "builder": 0: backtrace::backtrace::libunwind::trace
Step #1 - "builder": at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/libunwind.rs:88
Step #1 - "builder": 1: backtrace::backtrace::trace_unsynchronized
Step #1 - "builder": at /cargo/registry/src/github.com-1ecc6299db9ec823/backtrace-0.3.29/src/backtrace/mod.rs:66
Step #1 - "builder": 2: std::sys_common::backtrace::_print
Step #1 - "builder": at src/libstd/sys_common/backtrace.rs:47
Step #1 - "builder": 3: std::sys_common::backtrace::print
Step #1 - "builder": at src/libstd/sys_common/backtrace.rs:36
Step #1 - "builder": 4: std::panicking::default_hook::{{closure}}
Step #1 - "builder": at src/libstd/panicking.rs:200
Step #1 - "builder": 5: std::panicking::default_hook
Step #1 - "builder": at src/libstd/panicking.rs:214
Step #1 - "builder": 6: std::panicking::rust_panic_with_hook
Step #1 - "builder": at src/libstd/panicking.rs:477
Step #1 - "builder": 7: std::panicking::begin_panic
Step #1 - "builder": 8: migration_engine::main
Step #1 - "builder": 9: std::rt::lang_start::{{closure}}
Step #1 - "builder": 10: std::rt::lang_start_internal::{{closure}}
Step #1 - "builder": at src/libstd/rt.rs:49
Step #1 - "builder": 11: std::panicking::try::do_call
Step #1 - "builder": at src/libstd/panicking.rs:296
Step #1 - "builder": 12: __rust_maybe_catch_panic
Step #1 - "builder": at src/libpanic_unwind/lib.rs:82
Step #1 - "builder": 13: std::panicking::try
Step #1 - "builder": at src/libstd/panicking.rs:275
Step #1 - "builder": 14: std::panic::catch_unwind
Step #1 - "builder": at src/libstd/panic.rs:394
Step #1 - "builder": 15: std::rt::lang_start_internal
Step #1 - "builder": at src/libstd/rt.rs:48
Step #1 - "builder": 16: main
Step #1 - "builder": 17: __libc_start_main
Step #1 - "builder": 18: _start
Step #1 - "builder": note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
Step #1 - "builder": at ChildProcess.child.on (/workspace/node_modules/prisma2/build/index.js:107250:37)
Step #1 - "builder": at ChildProcess.emit (events.js:198:13)
Step #1 - "builder": at ChildProcess.EventEmitter.emit (domain.js:448:20)
Step #1 - "builder": at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
Step #1 - "builder": error Command failed with exit code 1.
Step #1 - "builder": error Command failed with exit code 1.
Step #1 - "builder":
Step #1 - "builder": error: `yarn_run_gcp_build` returned code: 1
Step #1 - "builder": Traceback (most recent call last):
Step #1 - "builder": File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main
Step #1 - "builder": "__main__", fname, loader, pkg_name)
Step #1 - "builder": File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
Step #1 - "builder": exec code in run_globals
Step #1 - "builder": File "/usr/local/bin/ftl.par/__main__.py", line 65, in <module>
Step #1 - "builder": File "/usr/local/bin/ftl.par/__main__.py", line 57, in main
Step #1 - "builder": File "/usr/local/bin/ftl.par/__main__/ftl/common/ftl_error.py", line 58, in UserErrorHandler
Step #1 - "builder": IOError: [Errno 2] No such file or directory: '""/output'
Finished Step #1 - "builder"
ERROR
ERROR: build step 1 "gcr.io/gae-runtimes/nodejs10_app_builder:nodejs10_20190602_10_16_0_RC00" failed: exit status 1
@pantharshit00
Copy link
Contributor

The error message looks very similar to #381 which got recently closed.

Can you please tell me where the database is hosted?

@pantharshit00
Copy link
Contributor

Also, please make sure you are on the latest version of prisma2

@pantharshit00 pantharshit00 added bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. kind/bug A reported bug. labels Sep 9, 2019
@divyenduz divyenduz removed their assignment Sep 9, 2019
@malekjaroslav
Copy link
Author

malekjaroslav commented Sep 9, 2019

This database is hosted on Google Cloud (Cloud SQL). I managed to make it work by connecting to a public IP. Sockets did not work, now trying to use SSL, but when I add it to the db connection string (sslcert, sslkey) it does not accept it. I am using the latest version of Prisma2.

@pantharshit00
Copy link
Contributor

Yes, right now we don't support those options.

Can you open an issue(ie feature request) for that 🙏

@malekjaroslav
Copy link
Author

@pantharshit00 What options do you mean? Sockets or SSL?

@pantharshit00
Copy link
Contributor

pantharshit00 commented Sep 9, 2019

We don't support sslcert and sslkey options right now.

I will need to confirm socket support

@malekjaroslav
Copy link
Author

malekjaroslav commented Sep 9, 2019

But sockets should work, is that correct? If so, what is the recommended connection string? I am unable to make it work

@malekjaroslav
Copy link
Author

malekjaroslav commented Sep 9, 2019

There is one more weird thing happening. Prisma init via sockets works, but migration (prisma2 lift up / prisma2 dev) fails

Screenshot from 2019-09-09 17-27-36

Screenshot from 2019-09-09 17-38-24

@malekjaroslav
Copy link
Author

@pantharshit00 Do you have some updates on this?

@pantharshit00
Copy link
Contributor

I think sockets are not supported in the Rust implementation right now.

The CLI uses the nodejs driver to do introspection right now.

@malekjaroslav
Copy link
Author

malekjaroslav commented Sep 13, 2019

@pantharshit00 But in the prism2 init flow it looks like is connecting through socket. Is this going to be solved somehow? Sockets are widely used in Google Cloud and other Cloud providers for connecting to databases.

@malekjaroslav
Copy link
Author

malekjaroslav commented Sep 13, 2019

In the docs of Prisma 2 it says to use any supported connection string and Rust's Postgresql implementation supports it https://docs.rs/postgres/0.15.2/postgres/struct.Connection.html#impl

Without sockets and SSL support, there is basically no way to communicate securely between the backend and the database...

@pantharshit00
Copy link
Contributor

I need to confirm this with the backend team. I don't work on the Rust part of the codebase, it might be a specific issue.

I will try to make a concrete reproduction for this.

@pantharshit00 pantharshit00 added bug/1-unconfirmed Bug should have enough information for reproduction, but confirmation has not happened yet. and removed bug/0-unknown Bug is new, does not have information for reproduction or reproduction could not be confirmed. labels Sep 13, 2019
@AhmedElywa
Copy link

AhmedElywa commented Sep 14, 2019

error when start after init

➜  prisma prisma2 lift save
Error: Error in migration engine: thread 'tokio-runtime-worker-1' panicked at 'get data_type', src/libcore/option.rs:1034:5
stack backtrace:
   0: std::panicking::default_hook::{{closure}}
   1: std::panicking::default_hook
   2: std::panicking::rust_panic_with_hook
   3: std::panicking::continue_panic_fmt
   4: rust_begin_unwind
   5: core::panicking::panic_fmt
   6: core::option::expect_failed
   7: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
   8: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
   9: sql_schema_describer::mysql::SqlSchemaDescriber::get_table
  10: <core::iter::adapters::Map<I,F> as core::iter::traits::iterator::Iterator>::fold
  11: <alloc::vec::Vec<T> as alloc::vec::SpecExtend<T,I>>::from_iter
  12: <sql_schema_describer::mysql::SqlSchemaDescriber as sql_schema_describer::SqlSchemaDescriberBackend>::describe
  13: <sql_migration_connector::sql_database_migration_inferrer::SqlDatabaseMigrationInferrer as migration_connector::database_migration_inferrer::DatabaseMigrationInferrer<sql_migration_connector::sql_migration::SqlMigration>>::infer
  14: <migration_core::api::MigrationApi<C,D> as migration_core::api::GenericApi>::infer_migration_steps
  15: migration_core::api::rpc::RpcApi::create_sync_handler
  16: tokio_executor::enter::exit
  17: tokio_threadpool::blocking::blocking
  18: <futures::future::lazy::Lazy<F,R> as futures::future::Future>::poll
  19: futures::future::chain::Chain<A,B,C>::poll
  20: <futures::future::then::Then<A,B,F> as futures::future::Future>::poll
  21: <futures::future::lazy::Lazy<F,R> as futures::future::Future>::poll
  22: futures::future::chain::Chain<A,B,C>::poll
  23: <futures::future::then::Then<A,B,F> as futures::future::Future>::poll
  24: <futures::future::map::Map<A,F> as futures::future::Future>::poll
  25: <futures::future::either::Either<A,B> as futures::future::Future>::poll
  26: <futures::future::map::Map<A,F> as futures::future::Future>::poll
  27: <futures::future::map_err::MapErr<A,F> as futures::future::Future>::poll
  28: <futures::stream::and_then::AndThen<S,F,U> as futures::stream::Stream>::poll
  29: <futures::stream::forward::Forward<T,U> as futures::future::Future>::poll
  30: <futures::future::map::Map<A,F> as futures::future::Future>::poll
  31: <futures::future::map_err::MapErr<A,F> as futures::future::Future>::poll
  32: futures::task_impl::std::set
  33: std::panicking::try::do_call
  34: __rust_maybe_catch_panic
  35: tokio_threadpool::task::Task::run
  36: tokio_threadpool::worker::Worker::run_task
  37: tokio_threadpool::worker::Worker::run
  38: std::thread::local::LocalKey<T>::with
  39: std::thread::local::LocalKey<T>::with
  40: tokio_reactor::with_default
  41: tokio::runtime::threadpool::builder::Builder::build::{{closure}}
  42: std::thread::local::LocalKey<T>::with
  43: std::thread::local::LocalKey<T>::with
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.`

@malekjaroslav
Copy link
Author

malekjaroslav commented Sep 16, 2019

@AhmedElywa are you running prisma prisma2 lift save or prisma2 lift save in prisma folder?

@AhmedElywa
Copy link

AhmedElywa commented Sep 16, 2019

@malekjaroslav
the folder name is prisma command prisma2 lift save

@malekjaroslav malekjaroslav changed the title Error when running lift up. Unix socket connection not working / "Lift up" failing Sep 16, 2019
@malekjaroslav
Copy link
Author

@pantharshit00 Hi, do you have some updates regarding this issue?

@pantharshit00
Copy link
Contributor

We will write a spec for this so that we integrate this in the schema.

We are on it, might take some time as it is a schema change.

@malekjaroslav
Copy link
Author

Great, thanks!

@malekjaroslav malekjaroslav changed the title Unix socket connection not working / "Lift up" failing Unix socket connection not working Sep 20, 2019
@timsuchanek
Copy link
Contributor

Thanks a lot for reporting 🙏
This issue is fixed in the latest alpha version of prisma2.
You can try it out with npm i -g prisma2@alpha.

In case it’s not fixed for you - please let us know and we’ll reopen this issue!

@daaasbu
Copy link

daaasbu commented Jan 23, 2020

@timsuchanek I'm not sure if this has fixed it for me. I'm using a typical docker compose for postgres to repro locally, that listens on unix socket: /var/run/postgresql/.s.PGSQL.5432.

version: "3.7"

services:
  db:
    image: postgres:12-alpine
    restart: always
    environment:
      POSTGRES_PASSWORD: mypassword
    volumes:
      - ./postgres-data:/var/lib/postgresql/data
    ports:
      - 5432:5432`

I am on alpha version: 2.0.0-alpha.538. I believe this is the last alpha version before the breaking changes introduced. I would upgrade but I also use nexus-prisma, so I'm waiting on the changes coming in there.

I'm in a similar situation where I would like to use this with Google Cloud Run and Cloud SQL in GCP.

When I try to make a gql query I get this error:

Invalid `photon.()` invocation in
/home/dana/Projects/flags/flag-core/flag-api/node_modules/nexus-prisma/src/builder.ts:238:18



Error parsing connection string: empty host
    at PhotonFetcher.request (/home/dana/Projects/flags/flag-core/flag-api/node_modules/@prisma/photon/index.js:62:23)

With the connection string (replace dbname)

POSTGRESQL_URL=postgresql://postgres:mypassword@/<dbname>?host=/var/run/postgresql/

I am able to connect to this just fine using other connection methods with a connection string.

@pimeys
Copy link
Contributor

pimeys commented Jan 23, 2020

This is at least fixed in the backend side, here's the test: https://github.com/prisma/quaint/blob/master/src/connector/postgres.rs#L421-L426

Is the javascript client using some weird URL parser that doesn't understand the socket without a host?

@pimeys
Copy link
Contributor

pimeys commented Jan 23, 2020

I remember @timsuchanek fixing it, but is the alpha.538 too old to contain the fix?

@pantharshit00
Copy link
Contributor

@daaasbu Can you please open a new issue about this? This particular issue tracks the progress of implementation of this feature which is done now. If you encounter any bugs please open a new issue. Also, please test it out with the latest version once 🙏

@nargetdev
Copy link

nargetdev commented Apr 25, 2020

This is a pretty important one - this is the documented path for most of GCP and especially important for any serverless deployment, as documented here GCP cloud run <==> SQL connection guide Has anybody managed to figure out a working connection string?

I'm currently trying:
DATABASE_URL="postgresql://USER:PASS@127.0.0.1/ying-staging?host=/cloudsql/DATABASE_NAME/.s.PGSQL.5432"

@Sytten
Copy link
Contributor

Sytten commented Apr 25, 2020

This worked for me: postgres://user:password@localhost/mydb?host=/cloudsql/myproject:us-east4:test

@pantharshit00
Copy link
Contributor

@nargetdev If I remember correctly, you should not append .s.PGSQL.5432 to the socket string. That will automatically get appended by the driver

Use postgresql://USER:PASS@127.0.0.1/ying-staging?host=/cloudsql/DATABASE_NAME

@papb
Copy link

papb commented Jul 17, 2020

Thank you very much @Sytten, that worked for me as well!!

@tylim88
Copy link

tylim88 commented Nov 19, 2020

@Sytten solution works like charm, it is very hard to find a solution for this case, I almost gave up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests