Describe the bug
Go Client Exists cause panic
To Reproduce
Steps to reproduce the behavior:
Expected behavior
panic: interface conversion: interface {} is nil, not map[string]interface {}
Screenshots

Versions (please complete the following information):
prisma CLI: prisma/1.18.0-alpha.3 (darwin-x64) node-v10.5.0This is true outside of just the Exists query. In general the generated go code seems to panic on any type of query failure and is not production ready.
Here you can see it will panic if the database cannot connect.
Error Exec: Post http://localhost:4466/dbaas/local: dial tcp 127.0.0.1:4466: connect: connection refused
Original Unpacked Data Step Exec: map[]
panic: interface conversion: interface {} is nil, not map[string]interface {}
In this case there is an Exec Error that is printed but not returned.
I experienced this issue on a different case where after a clean of my volumes with the "docker rm volume" command the code started to panic whatever the mutation, query, etc. In my case to have a working code again, I did "docker system prune" and "docker image prune"
@sirkay777, @gregwebs, @Sach97 Thanks for raising this. We have released a rewrite of Go client (available in beta version prisma/1.19.0-beta.0 that implements the fix for this, along with other important fixes.
Please give it a go and give us your valuable feedback.
Well I've installed the cli 1.19.0 alpha, git clone examples, docker-compose up, prisma deploy, gqlgen -v, and now it throws :
Unable to bind Post.author to prisma-examples/go-graphql/prisma-client.Post
no method named author
no field named author
Adding resolver method
Unable to bind User.posts to prisma-examples/go-graphql/prisma-client.User
no method named posts
no field named posts
Adding resolver method
/home/sacha/go/src/prisma-examples/go-graphql/server/generated.go
Unable to bind Post.author to prisma-examples/go-graphql/prisma-client.Post
no method named author
no field named author
Adding resolver method
Unable to bind User.posts to prisma-examples/go-graphql/prisma-client.User
no method named posts
no field named posts
Adding resolver method
Skipped resolver: prisma-examples/go-graphql/tmp.Resolver already exists
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:89:12: Builder not declared by package strings
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:22:33: Builder not declared by package strings
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:40:30: Builder not declared by package strings
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:98:32: Builder not declared by package strings
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:115:33: Builder not declared by package strings
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:26:2: invalid operation: b (variable of type *invalid type) has no field or method WriteByte
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:29:4: invalid operation: b (variable of type *invalid type) has no field or method WriteString
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:31:3: invalid operation: b (variable of type *invalid type) has no field or method WriteString
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:32:3: invalid operation: b (variable of type *invalid type) has no field or method WriteString
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:33:3: invalid operation: b (variable of type *invalid type) has no field or method WriteString
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:35:2: invalid operation: b (variable of type *invalid type) has no field or method WriteByte
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:43:3: invalid operation: b (variable of type *invalid type) has no field or method WriteByte
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:66:8: Builder not declared by package strings
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:69:3: invalid operation: b (variable of type *invalid type) has no field or method WriteString
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:71:3: invalid operation: b (variable of type *invalid type) has no field or method WriteString
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:73:3: invalid operation: b (variable of type *invalid type) has no field or method WriteString
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:78:2: invalid operation: b (variable of type *invalid type) has no field or method WriteByte
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:79:2: invalid operation: b (variable of type *invalid type) has no field or method WriteString
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:81:2: invalid operation: b (variable of type *invalid type) has no field or method WriteString
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:83:2: invalid operation: b (variable of type *invalid type) has no field or method WriteByte
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:85:9: invalid operation: b (variable of type *invalid type) has no field or method String
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:99:2: invalid operation: b (variable of type *invalid type) has no field or method WriteString
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:116:2: invalid operation: b (variable of type *invalid type) has no field or method WriteString
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:118:2: invalid operation: b (variable of type *invalid type) has no field or method WriteString
/home/sacha/go/src/github.com/prisma/prisma-client-lib-go/ast.go:120:2: invalid operation: b (variable of type *invalid type) has no field or method WriteString
validation failed: couldn't load packages due to errors: github.com/prisma/prisma-client-lib-go
And if I do go get -v github.com/prisma/prisma-client-lib-go, it throws :
../../github.com/prisma/prisma-client-lib-go/ast.go:22:33: undefined: strings.Builder
../../github.com/prisma/prisma-client-lib-go/ast.go:40:30: undefined: strings.Builder
../../github.com/prisma/prisma-client-lib-go/ast.go:66:8: undefined: strings.Builder
../../github.com/prisma/prisma-client-lib-go/ast.go:89:12: undefined: strings.Builder
../../github.com/prisma/prisma-client-lib-go/ast.go:98:32: undefined: strings.Builder
../../github.com/prisma/prisma-client-lib-go/ast.go:115:33: undefined: strings.Builder
Go version : go1.9.7 linux/amd64
"strings.Builder" was added in Go 1.10
Would it be possible for you to update your Go version?
@divyenduz works great! thanks!
"strings.Builder" was added in Go 1.10
Would it be possible for you to update your Go version?
Thank's a lot @divyenduz it doesn't throw the prisma-client-lib-go strings.builder error anymore and the server run on the example. As soon I've tested my schema I'll give my feedback.
Is it normal that I don't have autocompletion on relations like for example r.Prisma.User(...).Posts() since the fix ?
@Sach97 : You should have the autocompletions! Can you share your datamodel.prisma and tell me the steps to reproduce it? I can give it a go.
I just added a type Tag to the go-graphql example to test my question posted on the forum.
scalar DateTime
type Query {
feed: [Post!]!
drafts: [Post!]!
post(id: ID!): Post
}
type Mutation {
createDraft(title: String!, content: String!, authorEmail: String!): Post!
createUser(email: String!, name: String!): User!
deletePost(id: ID!): Post
publish(id: ID!): Post
createTag(id:ID!, name: [String!]!): Tag!
}
type Post {
id: ID!
createdAt: DateTime!
updatedAt: DateTime!
isPublished: Boolean!
title: String!
content: String!
author: User!
tags: [Tag!]!
}
type Tag {
id: ID!
name: String!
taggedOn: Post!
}
type User {
id: ID!
email: String!
name: String!
posts: [Post!]!
}
But even with the original schema I don't have autocompletion (mutation and queries are working). I can have it by retrieving the address with "&" inf front of prisma.UserWhereUniqueInput but it wil break. The code generates correctly the CreateTag types on generated.go and prisma.go but I don't have autocompletion for it either on my resolver.go (I have declared it correctly in gqlgen.yml)
@Sach97 : Interesting, can you please create a separate issue for this? https://github.com/prisma/prisma/issues/new/choose
As it is different from the original issue on this thread 馃檹
I've just posted my issue #3294 @divyenduz. I tried to be the more precise possible.
Looks much better! Docs still need to be updated.
@gregwebs Thanks! we will update the docs once this hits stable ETA for that is Oct 23rd.
I think this can be closed as fixed now.
This is released in the stable 1.19.0 - npm install -g prisma or brew tap prisma/prisma && brew install prisma 馃帀