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

    Manthan Mallikarjun

    05/25/2020, 11:16 PM
    I tried to do the following
  • m

    Manthan Mallikarjun

    05/25/2020, 11:17 PM
    Copy code
    import { prisma } from '../../../prisma/prisma';
    
    const mock = mockDeep<typeof prisma>();
    jest.mock('../../../prisma/prisma', () => mock);
    
    it('...', () => {
      mock.user.count.mockResolvedValue(2);
      fn()
    })
    and the function call does this:
    Copy code
    const userCount = await prisma.user.count({ where: ... });
  • m

    Manthan Mallikarjun

    05/25/2020, 11:17 PM
    but im getting
    undefined
    for userCount instead of 2
  • m

    Manthan Mallikarjun

    05/25/2020, 11:17 PM
    any help would be appreciated!
  • m

    Manthan Mallikarjun

    05/26/2020, 12:16 AM
    šŸ˜ž still havent been able to figure out
  • m

    Manthan Mallikarjun

    05/26/2020, 1:30 AM
    finally got it haha
  • p

    Philipp Rajah Moura Srivastava

    05/26/2020, 4:31 AM
    Hey everyone! So for the last few weeks I’ve been designing and beginning to implement a GraphQL API using Prisma. I’m at a stage where I have enough of an API foundation to think about developing frontend. I’ll be using react-native and I have a few questions regarding fetching data from my API. I want to be able to provide users with an offline experience and therefore require cache. I also want to use subscriptions (real-time functionality in GraphQL). I’ve found Apollo Client and seen that it has a lot of good reviews, however, I’m not a huge fan of the built in React components that display the data. I haven’t used them so I can’t really be sure that I don’t like them, however I don’t think they’ll be great for query testing which isn’t a huge deal since I’ll be thoroughly testing my API and Prisma is tested. On the other hand I’ve used redux in the past and am wondering if it has the possibly of acting as a sort of cache when paired with simple https requests. Any thoughts are appreciated! šŸ™
    r
    • 2
    • 2
  • m

    mape

    05/26/2020, 8:47 AM
    Hey, has anyone looked into getting https://www.elastic.co/apm to work with Prisma 2?
    r
    • 2
    • 7
  • m

    Matheus Assis

    05/26/2020, 12:02 PM
    I didn't manage to find a good way that explains the setup of nexus (the framework) with prisma. I don't get where is the entrypoint, and get typescript errors with every t.model(it says that it doesn't have the .model part). Do someone have some tips for that?
    n
    • 2
    • 6
  • j

    Jovaanc

    05/26/2020, 12:10 PM
    Hi, I'm trying to implement managementApiSecret but I can't do it, I have an error : "Authentication token is invalid: 'Authorization' header not provided"
    r
    p
    • 3
    • 6
  • j

    Jovaanc

    05/26/2020, 12:23 PM
    Where should I add the header ?
  • d

    Dulara Malindu Colombage

    05/26/2020, 1:40 PM
    I have a prisma project which uses prisma 1.29. I need to update it to latest prisma 1. Threre is a breaking change on prima 1.31. I use prisma cli 1.34.10 to generate new data model files. can I directly update to latest prisma 1 or do I have to come step by step?
  • d

    Dulara Malindu Colombage

    05/26/2020, 1:41 PM
    please help me migrate
  • d

    Dulara Malindu Colombage

    05/26/2020, 1:50 PM
    when I trying to deploy it gives me this error. this userID field is something very critical
    r
    • 2
    • 10
  • d

    Dulara Malindu Colombage

    05/26/2020, 2:03 PM
    all the userID’s were gone after the forceDeploy
  • j

    John Cantrell

    05/26/2020, 9:20 PM
    prisma working fine in my next.js app, just tried adding a background worker process (BullMQ) using the same codebase and prisma is now throwing an error about 'invalid findOne invocation' and then the exception has {"code": "ENOENT"}. but the same query works fine over in next.js land. any obvious ideas?
  • j

    John Cantrell

    05/26/2020, 9:20 PM
    params look good, types of params look good, not sure what else to check to try to debug this
  • j

    John Cantrell

    05/26/2020, 9:26 PM
    i assume the ENOENT means there's no connection?
  • j

    John Cantrell

    05/26/2020, 9:41 PM
    if i log my prisma client in the env where it's working and the one where it's not the main difference appears in the 'engine' key of client object. working one has (port, platform, child, url) and broken one does not
  • j

    John Cantrell

    05/26/2020, 10:03 PM
    feel like it has to be an issue from webpack doing something strange (missing files from node_modules or something, since they aren’t explicitly imported)? Anyone know of issues like this?
    r
    • 2
    • 1
  • a

    Alice

    05/27/2020, 2:40 AM
    Hi, when using prisma client fetching data from mysql, i always got null for all fields, when I opened info, and found below error: ā€œerrorsā€: [ { ā€œmessageā€: ā€œInvalid string lengthā€, ā€œlocationsā€: [ { ā€œlineā€: 2, ā€œcolumnā€: 3 } ], ā€œpathā€: [ ā€œdashboard_config2" ],
    r
    • 2
    • 3
  • a

    Alice

    05/27/2020, 2:41 AM
    my table definition is :
    Copy code
    create table scm_dashboard.dashboard_config2
    (
        `id`        varchar(255),
        `userId`    varchar(255) DEFAULT NULL,
        `vizState`  varchar(255) DEFAULT NULL,
        `changedAt` varchar(255) DEFAULT NULL,
        `createdAt` varchar(255) DEFAULT NULL,
        PRIMARY KEY (`id`)
    )
  • a

    Alice

    05/27/2020, 2:41 AM
    where is the issue?
  • a

    Alice

    05/27/2020, 2:42 AM
    prisma.dashboard_config2.create works perfectly, the issue only happens to prisma.dashboard_config2.findMany
  • j

    Jovaanc

    05/27/2020, 8:57 AM
    Hi, I've added PRISMA_MANAGEMENT_API_SECRET When I go on localhost:4466 it works, but not on localhost:4466/management, he says to me "Authentication token is invalid: Token can't be decoded: Invalid signature for this token or wrong algorithm." Yet I pass him the prisma token in the header...
    r
    • 2
    • 2
  • j

    Jovaanc

    05/27/2020, 11:48 AM
    How can I get the error that my server didn't start on my client?
  • j

    Jovaanc

    05/27/2020, 11:52 AM
    in console.log
    r
    • 2
    • 3
  • m

    Matheus Assis

    05/27/2020, 2:46 PM
    How would I filter using a "deep" property? For example, I have an
    User
    that has
    posts: Post
    How would I filter the list of users that has posted an specific post for example:
    Copy code
    query GetUser {
      users (after: { posts_some: { title_eq: 'My post' } }) {
        name
      }
    }
    I'm using nexus and prisma2, and nexus is not allowing me to filter that deep with
    t.crud.users()
    a
    • 2
    • 5
  • m

    Matheus Assis

    05/27/2020, 3:04 PM
    Is it possible to have a generics-like/inheritance model attribution in the
    schema.prisma
    ? Like:
    Copy code
    model User {
      name   String
      email  String
    }
    
    model LegalPerson {
      @@inherit(User)
    
      socialNumber   String
    }
    
    model Company {
      @@inherit(User)
    
      address   Address
    }
    And then have nexus output something like
    t.crud.Users()
    ?
    r
    • 2
    • 2
  • p

    Patryk Zdunowski

    05/27/2020, 3:23 PM
    Hey Community!
    🦜 5
    šŸ‘‹ 5
    šŸ™Œ 4
1...376377378...637Latest