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

    Max Tayebwa

    11/25/2019, 9:40 AM
    Hey, is there some way I can improve the speed of 'prisma deploy'? It is threateningly slow... It takes almost 5 minutes, I ran on a high-spec macbook, I am thinking this shouldn't be happening?
  • u

    Umair Khan

    11/25/2019, 11:30 AM
    Hello Everyone, I want to use aggregate method functionality same as Hasura (https://docs.hasura.io/1.0/graphql/manual/queries/aggregation-queries.html) Is it supported in Prisma?
  • v

    vjsingh

    11/25/2019, 3:40 PM
    If anyone else is seeing intermittent connection issues by any chance, I made a Github issue
  • v

    vjsingh

    11/25/2019, 3:40 PM
    https://github.com/prisma/prisma/issues/4945
    ✅ 1
  • d

    deactivateduser

    11/25/2019, 6:13 PM
    is there an example on how to add a nodejs backend to the docker-compose file? I don't really get how it's supposed to work as the backend has to deploy the prisma schema as well
  • d

    deactivateduser

    11/25/2019, 6:22 PM
    Okay well so my only issue seems to be that I need to deploy after my backend has been built... I don't understand how
    a
    • 2
    • 4
  • r

    Raul Saavedra

    11/25/2019, 8:45 PM
    Hello! New to Prisma and GraphQL here. I have an issue related to Nested Mutations. I have an User Type and an Item Type and want to connect the user to the item everytime I create a new one. Here is my datamodel:
    Copy code
    type User {
      id: ID! @id
      name: String!
      email: String! @unique
      password: String!
      resetToken: String
      resetTokenExpiry: Float
      permissions: [Permission] @scalarList(strategy: RELATION)
    }
    
    type Item {
      id: ID! @id
      title: String!
      description: String!
      image: String
      largeImage: String
      price: Int!
      createdAt: DateTime! @createdAt
      updatedAt: DateTime! @updatedAt
      user: User!
    }
    The generated part of Prisma:
    Copy code
    type Mutation {
      createItem(data: ItemCreateInput!): Item!
    }
    input ItemCreateInput {
      id: ID
      title: String!
      description: String!
      image: String
      largeImage: String
      price: Int!
      user: UserCreateOneInput!
    }
    
    input UserCreateOneInput {
      create: UserCreateInput
      connect: UserWhereUniqueInput
    }
    
    input UserWhereUniqueInput {
      id: ID
      email: String
    }
    And the resolver:
    Copy code
    async createItem(parent, args, ctx, info) {
        if (!ctx.request.userId) {
          throw new Error('You must be logged in to perform this action');
        }
        const item = await ctx.db.mutation.createItem(
          {
            data: {
              ...args,
              user: {
                connect: { id: ctx.request.userId }
              },
            },
          },
          info
        );
    
        return item;
      },
    However, I am getting an error: Field 'user' is not defined in the input type 'ItemCreateInput'. I would greatly appreciate your help!
    a
    • 2
    • 3
  • s

    Seppe Snoeck

    11/25/2019, 8:58 PM
    Hi, I am using prisma-nexus and I have a User type like this:
    type User {
    id: ID! @id
    email: String @unique
    firstName: String!
    lastName: String!
    password: String
    posts: [Post!]!
    }
    But I can query a user’s password. How can I prevent this?
    j
    • 2
    • 3
  • s

    Seppe Snoeck

    11/25/2019, 9:45 PM
    What is the best way to spit mutation and query resolvers in seperate files for prisma-nexus?
  • a

    andrew bantug

    11/25/2019, 10:30 PM
    Hey all, I'm deploying a prisma server with heroku and also a graphql-yoga server on heroku. I'd like to disable the playground from graphql-yoga I have no issue doing so locally but it stays available when deployed with heroku. I'm using heroku config vars in an attempt to disable, here's what my server looks like.
    Copy code
    require('dotenv').config()
    const { GraphQLServer } = require('graphql-yoga');
    const { Mutation, Query } = require('./resolvers')
    const { Prisma } = require('prisma-binding')
    
    const prisma = new Prisma({
      typeDefs: 'generated/prisma.graphql',
      endpoint: process.env.PRISMA_ENDPOINT,
      secret: process.env.PRISMA_SECRET
    })
    
    const server = new GraphQLServer({
      typeDefs: 'src/schema.graphql',
      resolvers: { Query, Mutation },
      resolverValidationOptions: {
        requireResolversForResolveType: false,
      },
      context: (req) => ({...req, prisma})
    });
    
    const options = {
      port: process.env.PORT,
      playground: process.env.GRAPHQL_PLAYGROUND
    }
    
    server.start(
      options,
      (options) => console.log(`Server Started. Running on port ${options.port}`)
    );
    k
    • 2
    • 4
  • n

    Nesh

    11/25/2019, 11:09 PM
    Could not find any optimistic locking document or example. so opened this issue: https://github.com/prisma/prisma/issues/4946
  • b

    Ben

    11/26/2019, 7:57 AM
    Hello hello
  • b

    Ben

    11/26/2019, 7:57 AM
    Question: Is there an easy way I can attach a version tag to my prisma deployment?
  • b

    Ben

    11/26/2019, 7:58 AM
    I wanne just 'prisma deploy' and then I want the endpoint to tell me which version of the datamodel it is holding
  • d

    Daniel Boros

    11/26/2019, 10:03 AM
    Hi guys, is there anyway to use prisma for login to facebook and store the datas into database?
  • c

    csamu

    11/26/2019, 11:48 AM
    Hey. If you're migrating from Graphcool to P,risma, is MongoDB+Prisma a good alternative?
    n
    • 2
    • 3
  • r

    Rayees

    11/26/2019, 12:45 PM
    i have an existing database i tried to generate datamodel for it but i am getting error
    Cannot read property 'fields' of undefined
    after i tried to execute command
    prisma init hello-world
  • r

    Rayees

    11/26/2019, 12:47 PM
    how can i generate model where i need to join tables from different schemas. is it even possible with prisma?
  • j

    Junior Vidotti

    11/26/2019, 2:00 PM
    Hey, folks. Seems that
    @unique
    directive together with relations is not working on Postgres (didn't tested another database). My model:
    type User {
    id: ID! @id
    name: String! @unique
    }
    type Profile {
    id: ID! @id
    user: User! @unique
    phone: String
    }
    Then I tried to create two profile to same user, thus violating @unique rule.
    mutation {
    operation1: createProfile(data: {
    user: {
    connect: {
    name: "Junior"
    }
    }
    phone: "<tel:5555555555|555 555-5555>"
    }) {id user {id name} phone}
    operation2: createProfile(data: {
    user: {
    connect: {
    name: "Junior"
    }
    }
    phone: "<tel:6665555555|666 555-5555>"
    }) {id user {id name} phone}
    }
    Prisma allowed:
    {
    "data": {
    "operation1": {
    "id": "ck3fxhkdh01zk0707j1rr31ri",
    "user": {
    "id": "ck3fx7fld01td0707xeenbd97",
    "name": "Junior"
    },
    "phone": "<tel:5555555555|555 555-5555>"
    },
    "operation2": {
    "id": "ck3fxhkds01zp0707ng658rsw",
    "user": {
    "id": "ck3fx7fld01td0707xeenbd97",
    "name": "Junior"
    },
    "phone": "<tel:6665555555|666 555-5555>"
    }
    }
    }
    • 1
    • 1
  • j

    Junior Vidotti

    11/26/2019, 2:03 PM
    Am I missing something or this is a bug?
  • l

    Lars Ivar Igesund

    11/26/2019, 6:41 PM
    I have run through the prisma (1) getting started tutorial with users and posts, using Typescript and Apollo instead of yoga. I am using react-admin on the frontend and when setting up the Posts collection, I get an issue with PostConnection.aggregate. The query sent by react-admin (via ra-data-graphql-prisma by @Marc-Antoine / @weakky) looks like this:
    Copy code
    query posts($where: PostWhereInput, $orderBy: PostOrderByInput, $skip: Int, $first: Int) {
      items: posts(where: $where, orderBy: $orderBy, skip: $skip, first: $first) {
        id
        title
        published
        author {
          id
          __typename
        }
        __typename
      }
      total: postsConnection(where: $where) {
        aggregate {
          count
          __typename
        }
        __typename
      }
    }
    m
    • 2
    • 35
  • l

    Lars Ivar Igesund

    11/26/2019, 6:44 PM
    The schema has
    Copy code
    type PostConnection {
      pageInfo: PageInfo!
      edges: [PostEdge!]!
      aggregate: AggregatePost!
    }
    but the result says:
    Copy code
    "errors": [
        {
          "message": "Unknown prisma-client function for field PostConnection.aggregate",
          "locations": [
            {
              "line": 13,
              "column": 5
            }
          ],
          "path": [
            "total",
            "aggregate"
          ],
    Is it the total part that is the problem maybe?
  • l

    Lars Ivar Igesund

    11/26/2019, 6:45 PM
    FWIW, just the items part works fine
  • l

    Lars Ivar Igesund

    11/26/2019, 6:53 PM
    And I have also changed the prisma index.ts to expose all the fields using prismaFields(['*'])
  • s

    Seppe Snoeck

    11/26/2019, 7:03 PM
    What is the best way to spit mutation and query resolvers in seperate files for prisma-nexus?
  • j

    jregistr

    11/26/2019, 7:36 PM
    What’s going on with GraphQL playground? Looks like no PRs have been accepted since Jun.
  • b

    Ben

    11/27/2019, 9:32 AM
    Every time I deploy my prisma backend, it requires the clients to have a new token. Why?
  • b

    Ben

    11/27/2019, 9:32 AM
    Is there any way I can prevent having to redeploy all my clients every time I deploy my backend? Can I not pin the prisma token, or get the same token for the same secret every time?
  • b

    Burim Ameti

    11/27/2019, 11:30 AM
    please advice me advanced prisma nodejs postgres
  • m

    Matt Wilson

    11/27/2019, 3:33 PM
    Hi -- I have some react code running on host https://web.example.com and my prisma API is at https://api.example.com. I'm seeing a bug where the react code just does POST to https://web.example.com, not https://api.example.com. I obviously did something wrong. I don't know if this could be in the prisma generate step, or in another step. Where does the generated code discover the prisma endpoint?
    i
    • 2
    • 7
1...335336337...637Latest