Open jy5275 opened 8 months ago
Can you share your URL string please if possible? Or can you try encoding the password in the DB string using encodeURIComponent()
?
Can you share your URL string please if possible? Or can you try encoding the password in the DB string using
encodeURIComponent()
?
datasource db {
provider = "cockroachdb"
url = "postgres://root@localhost:26257/defaultdb?sslmode=disable"
}
This is a local deployed CockroachDB by cockroach start-single-node --insecure
That error message looks like https://github.com/prisma/prisma-engines/issues/4613 which is still unclear why it happens. Can you maybe try using url = ENV("DATABASE_URL")
and setting the connection string with the DATABASE_URL
env? Just to see if it is related to this bug or something different
also please set PRISMA_CLIENT_GO_LOG=debug
and check if there are any other errors?
@steebchen Thanks. The connection succeed with url = ENV("DATABASE_URL")
. Debug log:
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.092567 temp dir: /tmp
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.092619 query engine exists, not unpacking. 54.494µs. at /tmp/prisma/binaries/engines/473ed3124229e22d881cb7addf559799debae1ab/unpacked/v2/prisma-query-engine-debian-openssl-3.0.x
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.092752 ensure query engine binary...
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.092784 temp dir: /tmp
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.092808 global cache dir: /home/ubuntu/.cache
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.096261 checking for local query engine `prisma-query-engine-linux-static-x64` or `prisma-query-engine-debian-openssl-3.0.x`
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.096294 checking for global query engine `/tmp/prisma/binaries/engines/473ed3124229e22d881cb7addf559799debae1ab/unpacked/v2/prisma-query-engine-linux-static-x64` or `/tmp/prisma/binaries/engines/473ed3124229e22d881cb7addf559799debae1ab/unpacked/v2/prisma-query-engine-debian-openssl-3.0.x`
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.096561 checking for cached query engine `/home/ubuntu/.cache/prisma/binaries/cli/5.12.0/473ed3124229e22d881cb7addf559799debae1ab/prisma-query-engine-linux-static-x64` or `/home/ubuntu/.cache/prisma/binaries/cli/5.12.0/473ed3124229e22d881cb7addf559799debae1ab/prisma-query-engine-debian-openssl-3.0.x`
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.096607 query engine found in cache path: /home/ubuntu/.cache/prisma/binaries/cli/5.12.0/473ed3124229e22d881cb7addf559799debae1ab/prisma-query-engine-debian-openssl-3.0.x &{name:prisma-query-engine-debian-openssl-3.0.x size:18388392 mode:493 modTime:{wall:566250604 ext:63848770587 loc:0x1b2d420} sys:{Dev:2064 Ino:287657 Nlink:1 Mode:33261 Uid:1000 Gid:1000 X__pad0:0 Rdev:0 Size:18388392 Blksize:4096 Blocks:35920 Atim:{Sec:1713173787 Nsec:666250599} Mtim:{Sec:1713173787 Nsec:566250604} Ctim:{Sec:1713173787 Nsec:566250604} X__unused:[0 0 0]}}
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.101492 version check took 4.831323ms
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.101524 using query engine at /home/ubuntu/.cache/prisma/binaries/cli/5.12.0/473ed3124229e22d881cb7addf559799debae1ab/prisma-query-engine-debian-openssl-3.0.x
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.101582 ensure query engine took 8.798098ms
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.102846 running query-engine on port 39263
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.103023 starting engine...
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.103364 connecting to engine...
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.103403 prisma engine payload: `{}`
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.104329 could not connect; retrying...
{"timestamp":"2024-04-15T09:38:43.109840Z","level":"INFO","fields":{"message":"Starting a postgresql pool with 17 connections."},"target":"quaint::pooled"}
{"timestamp":"2024-04-15T09:38:43.140801Z","level":"INFO","fields":{"message":"Started query engine http server on http://127.0.0.1:39263","ip":"127.0.0.1","port":"39263"},"target":"query_engine::server"}
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.204575 prisma engine payload: `{}`
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.206343 [timing] query engine raw request took 1.694211ms
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.206414 prisma engine response: `{"status":"ok"}`
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.206436 [timing] elapsed: 9µs
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.206462 [timing] just http: 1.685211ms
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.206471 [timing] http percentage: 99.47%
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.206503 connecting took 113.719797ms
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.206518 connected.
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.206522 disconnecting...
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.208226 disconnected.
[prisma-client-go] DEBUG: 2024/04/15 16:38:43.208244 query engine closed
PASS
ok CR-Prisma 0.118s
Awesome thanks. I still have to figure out the actual error but at least you got it working for now
Version
github.com/steebchen/prisma-client-go v0.35.0
Problem Description
I tried to use Go Prisma to connect my local single node CockroachDB in a demo
But always got error on
Connect()
(100% reproducible):spawn: query engine errored: expected value at line 1 column 1
However, I can successfully pull exsiting table schema from CockroachDB by
go run github.com/steebchen/prisma-client-go db pull
.Related Issue
I found issue 1128 reported the same problem. Its solution was to use a fix version
go get github.com/steebchen/prisma-client-go@a10327f06445dd9aa8edd63759ef253caf491541
. But that version didn't work for me, with the same error message.Logs
Full log with
PRISMA_CLIENT_GO_LOG=debug
set: