https://www.prisma.io/ logo
Join Slack
Powered by
# orm-help
  • k

    kitze

    10/20/2018, 8:30 AM
    Does anyone have an idea how to debug this?
    Copy code
    prisma generate
    Generating schema 27ms
     ▸    Syntax Error: Expected Name, found  }
    😥 1
    d
    j
    • 3
    • 25
  • a

    Anders

    10/20/2018, 8:51 AM
    How can we handle separate files for resolvers and schema? I would like to have one file per concern. Eg User.graphql and UserResolver.js Then Comment.graphql and CommentResolver.js
    k
    l
    • 3
    • 8
  • f

    Fi1osof

    10/20/2018, 10:52 AM
    At prisma team: is there sources for https://www.npmjs.com/package/prisma-generate-schema ?
    d
    • 2
    • 4
  • s

    shoggs

    10/20/2018, 11:53 AM
    Hi, can you do transactions on a MySQL db when using Prisma?
  • n

    Nitin Hayaran

    10/20/2018, 7:00 PM
    not sure about the etiquette here, but is it ok to ask for a problem i am running into. Its looking like a bug, but not entirely sure, if its some error on my part.
    h
    • 2
    • 1
  • n

    Nitin Hayaran

    10/20/2018, 7:05 PM
    I have a mutation
    Copy code
    async signup(parent, args, ctx, info) {
        // lowercase their email
        args.email = args.email.toLowerCase();
        // hash their password
        const password = await bcrypt.hash(args.password, 10);
        const user = await ctx.db.mutation.createUser(
          {
            data: {
              ...args,
              password
            }
          },
          info
        );
        return {
          user, // is always undefined
          token: utils.getToken(user)
        };
      }
    f
    • 2
    • 1
  • n

    Nitin Hayaran

    10/20/2018, 7:06 PM
    this doesn't work if my schema is like this.
    Copy code
    type SignupResponse {
      token: String!
      user: User!
    }
    
    type Mutation {
      signup(name: String!, email: String!, password: String!): SignupResponse!
    }
    However it works if i stop returning custom return type and start returning
    User
  • n

    Nitin Hayaran

    10/20/2018, 7:06 PM
    What am i missing
  • m

    Martin Hunt

    10/21/2018, 4:04 PM
    Hey all, I'm running in to the strangest issue. I have a very simple Yoga back end that I've set up to play around with some graphQL concepts and it's working great locally. However when I deploy to now.sh I'm seeing an issue where upon creating an entry it's actually creating two entries in the database each with a unique id. I've tested this on the playground of my deployed server to rule out the front end being an issue and I'm seeing the same thing. Running:
    Copy code
    mutation  {
      createListItem(title:"this is a test of a new item") {
        id
        title
      }
    }
    Returns one item. But then, when running:
    Copy code
    query {
      listItems(first:4 skip:0){
        id
        title
      }
    }
    I see two items returned with the same title and different ID's. My mutation is about as simple as it gets
    Copy code
    createListItem(parent, args, context, info) {
          return context.prisma.createListItem({ title: filter.clean(args.title) })
        }
    so I'm just not sure what could be going wrong here. Again, it's working fine locally and the only real difference between the two is the NODE_ENV. Both the local and deployed versions are connecting to the same Prisma demo database. If I go directly to the playground of the prisma database I don't get the same issue. Any help figuring out where to start would be appreciated beyond belief
    m
    • 2
    • 2
  • d

    ducdev

    10/21/2018, 4:45 PM
    Hi guys I have 1 question, does I need graphql-yoga to bind with prisma to write custom resolvers for my Queries and Mutations ?
    l
    • 2
    • 2
  • y

    yolen

    10/21/2018, 9:12 PM
    Hi guys. I consider running graphql-yoga and prisma on the same ec2 instance using docker-compose. The db on aws rdb. Is that a good idea? Currently I do not need much scaling and I find docker-compose simpler than e.g. yoga on lambda and prisma on fargate cluster. What are your thoughts?
    l
    • 2
    • 4
  • n

    Nick

    10/22/2018, 7:00 AM
    Hi guys! really need help with caching. I trying use graphql-yoga and just setup cacheControl but... that look like not work... or maybe i'm not understand some
    h
    • 2
    • 5
  • n

    Nick

    10/22/2018, 7:01 AM
    it's possible to use memcache like store in store option? that will work?
  • n

    Nick

    10/22/2018, 7:02 AM
    my config
    Copy code
    server.start({
          debug: true,
          cacheControl: {
            defaultMaxAge: 5
          },
          port: process.env.PORT,
          playground: process.env.PLAYGROUND
        },
        () => log(`🚀  Server is running on localhost:${process.env.PORT}`)
    but when i send request to server i see what no caching in this moment
  • n

    Nick

    10/22/2018, 7:05 AM
    in my schema i have some think like
    Copy code
    type Address @cacheControl(maxAge: 86400) {...fields...}
    but anyway request will directed to db
  • y

    yolen

    10/22/2018, 8:02 AM
    Simple question. In javascript I have a resolver like
    Copy code
    const resolvers = {
        Query: {      
            laws(parent, args, context, info) {            
                return context.prisma.query.laws(
                    { where: args.where, skip: args.skip, first: args.first, orderBy: args.orderBy },
                    info,
                )
            },        
        },
    }
    , but i struggle to get it working in typescript :
    Copy code
    export const Query: QueryResolvers.Type = {
      ...QueryResolvers.defaultResolvers,
     
      laws: (parent, args, ctx) => ctx.db.laws({where: args.where})
    
    }
    throws the error
    Property 'where' does not exist on type '{}'.
    I have then tried to do something like
    Copy code
    interface LawsArgs{
      where?: lawsArgs.LawWhereInput;
      orderBy?: lawsArgs.LawOrderByInput;
      skip?: <http://lawsArgs.Int|lawsArgs.Int>;
      after?: String;
      before?: String;
      first?: <http://lawsArgs.Int|lawsArgs.Int>;
      last?: <http://lawsArgs.Int|lawsArgs.Int>;
    }
    
    export const Query: QueryResolvers.Type = {
      ...QueryResolvers.defaultResolvers,
      laws: (parent, args:LawsArgs, ctx) => ctx.db.laws({where: args.where})
    
    }
    but still no luck.. (I am a typescript newbie :-()
    n
    • 2
    • 20
  • a

    aroman

    10/22/2018, 2:02 PM
    Hi all, Im having this weird issue where I'm missing a role (whose type is an enum) field from my user object in the datamodel.
    Copy code
    type User {
      id: ID! @unique
      email: String @unique
      firstName: String!
      middleName: String
      lastName: String!
      password: String!
      role: Role!
      orders: [Order!]!
    }
    
    enum Role { 
      Admin
      Owner
      Physician
      Patient
      Provider
      Disabled
    }
    when I
    createUser()
    I've manually added the Role, and I have tried to also put it as a
    @default
    directive, however, when I call back or fetch on user the Role value is not there thus interfering with my permissions etc. Would any one able to shed some light? I am using prisma 1.17
    h
    • 2
    • 12
  • s

    Sach97

    10/22/2018, 2:43 PM
    Hi Prisma team, I managed to make a simple POC https://github.com/Sach97/prisma-go-subscription-experiments with a subscription query against the prisma ws endpoint with the same datamodel from example repo. My subscribe only takes a query string in argument for the moment and return a go channel. It is a toy program but I hope it can help the team. I'll try to play with the ast of the query now 🙂. Design question, once I have something nice, should I fork prisma/prisma-client-lib-go with an interface let's say like this
    Copy code
    type Client struct {
    	Endpoint string
    	Secret   string
        Session *Session
    	GQLClient *graphql.Client
    }
    
    type Session struct {
    	ws      *websocket.Conn
    	errChan chan error
    }
    Or fork both prisma-client-lib for the channel part and machinebox/graphql for the websocket connection part ?
  • l

    lawjolla

    10/22/2018, 5:22 PM
    Will graphqlgen have a more formal announcement and will there be more complete docs?
    h
    • 2
    • 4
  • b

    brentsoles

    10/22/2018, 5:44 PM
    Question: I know it isn't official, but is there any way to use prisma for an exisiting MongoDB setup?
    h
    n
    d
    • 4
    • 9
  • n

    Nuno

    10/22/2018, 5:55 PM
    Hey guys, I’m a UI designer and developer which recently came across the need to display data on an interface using graphQL, while I know little about data handling I came across graphql-request and was able to console.log data
  • n

    Nuno

    10/22/2018, 5:57 PM
    The question is now that I don’t know how to grab the data to display across the interface, if anyone could point me some resources on a way to do it, that would appreciated
    h
    • 2
    • 19
  • n

    Nuno

    10/22/2018, 5:59 PM
    the log
  • w

    wontwon

    10/22/2018, 7:05 PM
    I’m having an issue with using prisma deploy with the graphql-cli. Here’s what I’m doing: -Set up new graphql app via graphql-cli, run prisma init to add a heroku hosted prisma server. When I run prisma deploy, I get a “mutiple graphql version error”
    y
    h
    • 3
    • 11
  • t

    Ted

    10/22/2018, 8:37 PM
    Hi guys, is it possible that I setup Prima on top the rest API only without changing exiting code base?
    h
    n
    • 3
    • 14
  • t

    tim

    10/23/2018, 1:07 AM
    hi all, i am trying to figure out the simplest structure for data entry for my application. I am building past setlists for concerts, so my models look like this:
    Copy code
    type Song @model {
      id: ID! @isUnique
      name: String!
    }
    
    type ConcertSong @model {
      id: ID! @isUnique
      song: Song @relation(name: "Songs")
      concerts: [ConcertSong!]! @relation(name: "ConcertSongs")
    }
    
    type Concert @model {
      id: ID! @isUnique
      venue: Venue! @relation(name: "ConcertVenue")
      start: DateTime!
      setlist: [ConcertSong!]! @relation(name: "ConcertSongs")
      opener: Artist 
    }
    data entry will be adding a bunch of songs, then a bunch of concerts, then a bunch of ConcertSong's... is there a way to add ConcertSongs without having to find the id (something more human readable). also, is there a better way to do a bunch of data entry like this than mutations? there will likely be hundreds of concerts and songs. Thanks!
    h
    • 2
    • 15
  • f

    Fran Dios

    10/23/2018, 7:45 AM
    Does anybody have issues with nested mutations when updating many entities at once? Like using
    connect
    inside
    updateManyPosts
    . It returns the correct “count” of modified entities but nothing has changed in the DB 🤔 Edit: seems that it’s already reported https://github.com/prisma/prisma/issues/2010
    👍 1
  • n

    nuno

    10/23/2018, 9:35 AM
    Will prisma-binding be updated to graphql 14? I'm getting warnings because now graphql-yoga installs graphql 14 and other dependencies have graphql "^0.13.0"
    f
    e
    • 3
    • 5
  • h

    hinsxd

    10/23/2018, 12:30 PM
    Hi there.
  • h

    hinsxd

    10/23/2018, 12:31 PM
    While querying with prisma client is great, I want to implement search function with it.
1...138139140...637Latest