https://www.prisma.io/ logo
Join SlackCommunities
Powered by
# prisma-client
  • m

    mo

    12/14/2018, 2:13 PM
    I have no idea why it has type error here: Trying to connect an entry to another, and I get this weird error from Flow: Even if I manually put 'sadkmlkmqw' as id it still fails. Clearly an issue with generated types?
  • s

    siyfion

    12/14/2018, 3:06 PM
    Hmm… having some issues debugging the prisma client.. 😕
  • s

    siyfion

    12/14/2018, 3:07 PM
    I run a query and I get the following output:
    Copy code
    ~/Git/onezone-test-server   master ●  yarn start
    yarn run v1.12.3
    $ ts-node src/index.ts
    🚀 Apollo server running and ready at <http://localhost:3000/>
    
    Query:
    query ($where: UserWhereInput) {
      users(where: $where) {
        id
        email
        firstName
        lastName
        location
        metadata
        role
        username
      }
    }
    
    Variables:
    {"where":{"username":"test"}}
  • s

    siyfion

    12/14/2018, 3:07 PM
    No error, nothing!
  • s

    siyfion

    12/14/2018, 3:09 PM
    And the console log output is simply
    RESULT: undefined
    from:
    Copy code
    return prisma.$exists
            .user({ username: args.username })
            .then(exists => {
              console.log('RESULT:', exists)
              return !exists
            })
            .catch(err => {
              console.log('ERROR:', err)
              throw err
            })
  • m

    mo

    12/14/2018, 3:09 PM
    And the console log output is simply
    RESULT: undefined
    from:
    I had this exact silent failure with
    prisma-binding
    now switching, damn it.
  • s

    siyfion

    12/14/2018, 3:11 PM
    I think it’s because it’s actually failing to talk to the Prisma server, but I can’t be sure, and there’s no error!
  • m

    mo

    12/14/2018, 3:16 PM
    I don't know why it would be failing, I check the same exact endpoint localhost:4466, playground fully works 🤷 no error, that's where we're stuck!
  • s

    siyfion

    12/14/2018, 3:17 PM
    Yeah, a little stuck to say the least now
  • m

    mo

    12/14/2018, 3:17 PM
    If you figured it out, please let us know too! 🙌
  • s

    siyfion

    12/14/2018, 3:18 PM
    Will do, though it’s more likely that when the Prisma team (esp. @nikolasburk) wake up and come online, they might chime in with some ideas!
    m
    • 2
    • 3
  • p

    prilutskiy

    01/03/2019, 11:53 AM
    when using
    $subscribe
    it stops emitting events after some idle period
    s
    • 2
    • 1
  • p

    prilutskiy

    01/03/2019, 11:53 AM
    Did anyone experience such issue?
  • p

    prilutskiy

    01/03/2019, 11:53 AM
    This is the code:
    Copy code
    // Send confirmation email when emailConfirmationToken is created or updated
      $subscribe
        .userSecurity({
          mutation_in: ['UPDATED'],
          updatedFields_contains: 'emailConfirmationToken',
        })
        .node()
        .user()
        .then(async (iterator) => {
          while (true) {
            const result = await iterator.next();
    
            const userService = ioc.get<IUserService>(Services.UserService);
            const userId = result.value.id;
            const user = await userService.getUserById(userId);
    
            if (!user.security.emailConfirmationToken) { continue; }
    
            const emailText = `
            Your email confirmation token is ${user.security.emailConfirmationToken}
          `;
            emailService.sendMessage(user.email, 'Email confirmation', emailText);
          }
        });
  • r

    Romain Criton

    01/03/2019, 10:44 PM
    Hi I'm trying to do something with the Prisma client and can't get my head around it:
    s
    • 2
    • 4
  • r

    Romain Criton

    01/03/2019, 10:44 PM
    Copy code
    const usersWithNoName = await prisma
      .users({
        where: {
          name: null
        }
      })
    🆙 1
  • r

    Romain Criton

    01/03/2019, 10:45 PM
    trying to filter records to only fetch those with a `null`value in a particular field
  • r

    Romain Criton

    01/03/2019, 10:46 PM
    The above request doesn't work. It doesn't return the expected records
  • r

    Romain Criton

    01/03/2019, 10:59 PM
    I've worked around the limitation by using
    prisma.$graphql
    instead but it would be nice to have that in the client
  • p

    prilutskiy

    01/08/2019, 2:05 PM
    Hi all With prisma-client I can do the following:
    Copy code
    <http://db.post|db.post>({ id: '123'}).coments();
    But is there a way to somehow get the following working?
    Copy code
    db.posts().comments();
    n
    l
    • 3
    • 4
  • e

    Elfayer

    01/09/2019, 9:01 AM
    I'm having some weird behavior here, it's probably me misunderstanding Prisma client. Can someone explain to me the following?
    Copy code
    const { prisma } = require('../src/generated/prisma')
    
    prisma.updateManyPosts({ /* ... */ }).then() // Works
    prisma.updateManyPosts({ /* ... */ }) // Doesn't get executed
    }
  • p

    prilutskiy

    01/09/2019, 9:03 AM
    @Elfayer
    prisma.updateManyPosts()
    returns
    Promise
    , so you need either
    .then((data) => ...)
    or
    await prisma.updateManyPosts()
    to access the output
  • e

    Elfayer

    01/09/2019, 9:04 AM
    Right, I'm saying it doesn't even get executed, what if I don't care the output? I just want to write a job that gets executed every day.
  • p

    prilutskiy

    01/09/2019, 9:06 AM
    Oh, I see
  • p

    prilutskiy

    01/09/2019, 9:06 AM
    Seems like a bug then
  • e

    Elfayer

    01/09/2019, 9:08 AM
    I'm wondering😁
  • e

    Elfayer

    01/09/2019, 9:30 AM
    @prilutskiy created an issue: https://github.com/prisma/prisma/issues/3827
  • m

    Mo

    01/09/2019, 5:32 PM
    Hi everyone, I can't get my mutations to work since i removed prisma-binding and added prisma-client, i keep getting this error even though everything is sent
  • m

    Mo

    01/09/2019, 5:32 PM
    -.txt
    n
    • 2
    • 8
  • e

    Elfayer

    01/10/2019, 5:11 AM
    Is there a reason why the
    where
    key is always mandatory on mutating many link types? I moved from 1.19 to 1.24, (it didn't work well before), and now I have to mention a
    where
    . What if I want all links to get updated? Like in:
    Copy code
    prisma.updateLoan({
      where: { id: args.id },
      data: {
        items: {
          // Here update and updateMany require a where
        }
      }
    })
    So it's either I call
    updateLoan
    and I have to mention a
    where
    on
    loan.items
    or I call
    updateManyLoans
    and I can't even call
    items
    inside `data`🤔
    s
    b
    • 3
    • 2
12345...23Latest