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

    Sanjay

    07/31/2019, 12:08 AM
    ^ Could someone please either assist with this issue or direct me to the appropriate person? Thanks.
  • j

    James

    07/31/2019, 5:53 AM
    I made some changes to my datamodel and redeployed. After that admin stopped working. I can't get past the spinning loading indicator. What can I do to restart admin?
    s
    • 2
    • 1
  • t

    tmoney

    07/31/2019, 5:47 PM
    Is anyone deployed on Digital Ocean with Prisma? And if so, would you recommend it, and have you had any issues so far? I'm debating switching from Heroku because of the cost
    e
    m
    +2
    • 5
    • 5
  • s

    shane

    07/31/2019, 10:01 PM
    Does anybody know how to generate nullable array fields with nexus? example would be:
    Copy code
    const foo = inputObjectType({
      name: 'foo',
      definition(t) {
        t.string('bar', { list: true, nullable: true })
      }
    })
    generated input is always:
    Copy code
    input foo {
      bar: [String!]
    }
    desired outcome would be:
    Copy code
    input foo {
      bar: [String]
    }
    h
    h
    • 3
    • 11
  • c

    Chad H

    08/01/2019, 1:23 AM
    Hi, is it possible for subscription to return a list? from my research, it looks like it will return one object at a time but just want to confirm. Thanks!
    h
    • 2
    • 2
  • j

    Jose Garcia

    08/01/2019, 7:15 AM
    Has anyone deployed a project in any aws service? If so, which one and what approach was taken?
    a
    • 2
    • 1
  • k

    Kolja Es

    08/01/2019, 12:10 PM
    Anyone else facing problems due to too many tasks produced by Prisma Client? It seems that our task queue is flooded on some requests, leading to a
    RejectedExecutionException
    as well as memory spike that temporarily takes down our server (probably due to moving pages from memory to swap). Rough datamodel:
    Copy code
    type User {
      decks: [Deck]
    }
    type Deck {
      creator: User!
      cards: [Card]
      learningState: [LearningState]
    }
    type Card {
      repetitions: [Repetition]
    }
    type Repetition {
      ...
    }
    type LearningState {
      ...
    }
    Now we are using Prisma Client and our resolvers are basically set up according to the [guide](https://www.prisma.io/tutorials/a-guide-to-common-resolver-patterns-ct08#scenario-implementing-relations-with-prisma-client):
    Copy code
    export default {
      Query: {
        decks: async (_, __, ctx: IContext) => {
          const userId = …;
          return prisma.decks({ where: { creator: { userId } } });
        },
      },
      Deck: {
        cards(parent) {
          return prisma.deck({ id: parent.id }).cards();
        },
        // Same for creator and some other fields
      },
    }
    Let’s assume we have a user with a single deck containing just two cards. This is our query:
    Copy code
    decks {
      ...
      learningState { … }
      cards {
        ...
        repetitions { … }
      }
    }
    This produces the following queries (some batched together, shown by enabling tracking of slow queries and setting threshold to
    0
    ):
    Copy code
    1. decks (scalars)
    2. batch: [deck#1 cards, deck#1 learningState]
    3. batch: [deck#1 cards, deck#1 learningState] (exact duplicate of 2.)
    4. batch: [card#1 repetitions, card#2 repetitions]
    5. batch: [card#1 repetitions, card#2 repetitions] (exact duplicate of 4.)
    As can be seen, there are a couple of duplicates. We would like to keep using Prisma Client while reducing the number of queries so that the task queue is not flooded and our server stays alive 🙂 I’ve tried to make use of fragments but the cards are still queried individually. Is it possible to eliminate the queries for each individual card? Are we correct in the assumption that queries of this form (e.g. with 1000+ cards) could cause memory spikes and thus downtime? Anyone else facing these problems? Thanks! (Happy to post this somewhere else if helpful) prisma-client-lib, docker image, CLI all at 1.34.3. Update: Changed post to reflect current situation.
    h
    • 2
    • 4
  • b

    Bradley

    08/01/2019, 2:17 PM
    Hi guys, super simple but annoying issue. Trying to update a User and set a
    reportsTo
    field to null/no relation where
    reportsTo
    is a relation to another User. Prisma Admin shows a relation to a user, however I always get this contradictory response... Any ideas? Documentation is little to none on disconnects
    h
    • 2
    • 13
  • p

    pllumh

    08/01/2019, 2:26 PM
    Hello. Is there anyway to make raw SQL Query using
    prisma-client-lib
    which is generated with 'grapql create` command ?
  • p

    pllumh

    08/01/2019, 2:28 PM
    I really need to be able to make raw queries, since I need to filter places by coordinates/radius
    j
    h
    • 3
    • 2
  • r

    Richard Perkins

    08/01/2019, 2:45 PM
    Hello. I'm using NodeJS/Apollo Server to work with Prisma. I have a bunch of custom mutations that have custom logic within them and then forwards the request onto Prisma afterwards. I've noticed that if I create something via a nested mutation (using create:{} instead of connect:{}) then the custom logic I have doesn't get triggered. Is there a way to make it so no matter how an object is created (via a mutation or from any level of a nested create relationship) that my custom logic will always be called for that entity?
    h
    • 2
    • 1
  • j

    Jo

    08/01/2019, 10:28 PM
    Is this product mature enough to connect to a MongoDb server
    h
    • 2
    • 2
  • p

    Pkmmte

    08/01/2019, 10:47 PM
    Hey guys, I'm working on a recommendation engine for my company and the most reliable/robust way I found to track actions (page views, likes, shares, etc for each article) was to create a new row for a custom model. (ContentAction) My question: Is this an appropriate way of doing this? We'd just like to query/sort content based on amount of engagement between a time period. Given that Prisma does not support atomic mutations, this was the best I could think of. We get about 2 million page views per month, so I expect to create 24 million+ rows per year. Somehow, that feels wrong.
  • o

    Olaf

    08/02/2019, 5:20 AM
    I am developing a dashboard with stats from the database (e.g. total number of users). What is the typical approach to returning a whole bunch summarised values from several tables in the database? Would one have a single query which returns a structured number of fields corresponding to these totals or perhaps Prisma offers an elegant way to achieve? What are people using?
  • r

    rein

    08/02/2019, 8:55 AM
    quick question, if I were to continue working with prisma 1 for now, how easy would it be to migrate to prisma2 when it is more production ready?
    h
    m
    • 3
    • 9
  • i

    Isaac Weber

    08/02/2019, 1:07 PM
    So it seems prisma has been the champions of the resolver first methodology. I have been looking into it more and it seems like a good solutions to a few of the current graphql problems. My team is going to be using graphql for an upcoming project. We want to make sure we are not getting locked into a SDL first development. Currently it seems frameworks around resolver first methodology is still really new. Would it be worth going down that road with something like graphql-nexus?
  • c

    captaindaylight

    08/02/2019, 4:20 PM
    Question about a self relation query, I have a referral datamodel like:
    Copy code
    type Referral {
      referrer: User! @relation(name: "UserReferrals")
      referee: User! @relation(name: "UserReferee")
    }
    When I try to get the referral by the referee with prisma client, I’m doing this:
    Copy code
    const referral = await prisma.referral({ where: { referee: { id: user.id } } });
    But gotten the error:
    Copy code
    Variable '$where' expected value of type 'ReferralWhereUniqueInput!' but got: {\"where\":{\"referee\":{\"id\":\"cjyu929lr00c7086128xdf46n\"}}}. Reason: 'where' Field 'where' is not defined in the input type 'ReferralWhereUniqueInput'. (line 1, column 8):\nquery ($where: ReferralWhereUniqueInput!)
    h
    k
    • 3
    • 3
  • o

    Olaf

    08/02/2019, 11:41 PM
    I keep reading that it is bad practice to expose the primary key to the user in cases like front-end routes
    <http://example.com/user/12345|example.com/user/12345>
    , is this the case for Prisma, since it generates an “ID” in no specific sequence? Or would I need to make a slug-like column for each user? What is acceptable?
  • i

    impowski

    08/03/2019, 2:09 AM
    Has anyone found a way to use custom directives with
    nexus
    ?
  • t

    tmoney

    08/03/2019, 7:11 AM
    Has anyone experienced really bad performance problems with deep nested query strings? I’m moving over from graphcool, and I’m seeing a 3-4x slow down in comparison to the exact same query from graphcool
  • t

    tmoney

    08/04/2019, 1:26 AM
    We ended up having to go with MySQL on heroku in order to get around the performance problems we were having. We couldn’t migrate our graphcool data to Postgres with inline tables, but we have been able to with MySQL. So we’ll need to figure out how to deploy to the ClearDB addon with Heroku. @Harshit is there any sort of guidance you could provide here?
    h
    • 2
    • 5
  • l

    Luke

    08/04/2019, 1:59 AM
    How is everyone deploying prisma / graphql-yoga in production ?
  • d

    donedgardo

    08/04/2019, 2:17 AM
    zeit the graphql server, and prisma in google cloud
  • l

    Luke

    08/04/2019, 2:42 AM
    @donedgardo Thanks!
  • n

    nileio

    08/04/2019, 3:20 AM
    hi everyone !
  • n

    nileio

    08/04/2019, 3:21 AM
    i just read the article about code-first graphql servers and i liked it so thought i will join the convo here
  • n

    nileio

    08/04/2019, 3:22 AM
    hows everyone progressing with this code-first implementations - lessons learned - tools etc. i am interested to learn
    h
    • 2
    • 1
  • r

    Ross O'Brien

    08/04/2019, 1:59 PM
    Hi all, hope someone can help me. Firstly when using the info object in my mutations am I right it only returns the information defined in the schema for that Mutation. For example if I have defined a mutation `createEvent`:
    createEvent(title: String!, description: String, startDate: DateTime!, locations: [Locations]): Event!
    Am I right in saying once I run the actual mutation:
    Copy code
    async createEvent(parent, args, ctx, info) {
        const { title, description, locations, startDate } = args;
        const { userId } = ctx.request;
    
        const newEvent = await ctx.db.mutation.createEvent(
          {
            data: {
              title,
              description,
              locations: { create: [...locations] },
              startDate,
              leader: {
                connect: {
                  id: userId,
                },
              },
            },
          },
          info
        );
    
        return newEvent;
    Then
    newEvent
    will only contain the
    id
    ,
    description
    ,
    startDate
    and
    Locations
    array? I want to return everything defined in my
    Event
    datamodel as I will be using it in a subscription:
    Copy code
    type Event {
    id: ID! @Unique @id
    leader: User! @relation(name: “UserEvents”)
    title: String!
    description: String
    startDate: DateTime!
    attendees: [User] @relation(name: “AttendingEvents”)
    locations: [Location] @relation(name: “EventLocations”)
    comments: [Comment]
    updatedAt: DateTime! @updatedAt
    createdAt: DateTime! @createdAt
    }
    What is the best practice for doing this? Thanks Ross
    h
    • 2
    • 2
  • s

    soren

    08/04/2019, 2:12 PM
    Hi I'm having some trouble deploying. Using Prisma for the first time
  • s

    soren

    08/04/2019, 2:13 PM
    Keep getting this error: 'ERR_INVALID_URL': Invalid URL: 192.168.99.100
    h
    • 2
    • 1
1...297298299...637Latest