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

expected value at line 1 column 1 on overriden datasources with some connection strings #4613

Open
steebchen opened this issue Dec 24, 2023 · 4 comments

Comments

@steebchen
Copy link
Contributor

steebchen commented Dec 24, 2023

The Go client overrides the datasources. This works fine, but it seems to break with some datasource URLs, e.g.

 ~/projects/prisma/prisma-go-demo | on main *1 !2 ?1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- at 02:01:34 
> export DATABASE_URL="postgresql://hatchet:hatchet@postgres:5432/hatchet?sslmode=disable"

 ~/projects/prisma/prisma-go-demo | on main *1 !2 ?1 ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- at 02:01:38 
> go run .                                                                                
2023/12/25 02:01:40 expected value at line 1 column 1
panic: spawn: query engine errored: expected value at line 1 column 1

goroutine 1 [running]:
main.main()
        /Users/steebchen/projects/prisma/prisma-go-demo/main.go:14 +0x38
exit status 2

The full error message is always:

{"is_panic":false,"message":"expected value at line 1 column 1","backtrace":"   0: <unknown>\n   1: <unknown>\n   2: <unknown>\n   3: <unknown>\n   4: <unknown>\n   5: <unknown>\n"}

Now the weirdest part is that a similarly looking but slightly different datasource URL is working:

export DATABASE_URL="postgresql://test:test@test:5432/test?sslmode=disable"

go run .

// works!

I am going a bit crazy now debugging this, not really sure if encoding of the datasource URL has anything to do with this or if this ist just random at this point...

Any pointers would be highly appreciated, I can also prepare a full small reproduction with the Go client if needed.

@Jolg42
Copy link
Member

Jolg42 commented Jan 3, 2024

I can indeed reproduce with

git clone git@github.com:steebchen/prisma-go-demo.git
cd prisma-go-demo

Then edit the datasource to

datasource db {
  provider = "postgresql"
  url      = env("DATABASE_URL")
}

and finally

export DATABASE_URL="postgresql://hatchet:hatchet@postgres:5432/hatchet?sslmode=disable"
go run github.com/steebchen/prisma-client-go generate
go run .

@Jolg42
Copy link
Member

Jolg42 commented Jan 3, 2024

Things get weird when trying different connection strings

This work, with mypostgres as host

export DATABASE_URL="postgresql://hatchet:hatchet@mypostgres:5432/hatchet?sslmode=disable" 

And this doesn't work, with postgres as host

export DATABASE_URL="postgresql://hatchet:hatchet@postgres:5432/hatchet?sslmode=disable" 

@steebchen
Copy link
Contributor Author

@Jolg42 Can you reproduce in the JS client as well? Or did you test it using the Go client?

@Jolg42
Copy link
Member

Jolg42 commented Jan 3, 2024

I only tried using the go client, I doubt that it is reproducible with the JS client.
Did you reproduce this using the JS Client?

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

No branches or pull requests

2 participants