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

    Joonatan

    11/16/2021, 6:03 PM
    Has anyone had any success on deploying prisma with serverless webpack to aws lambda? With webpack the issue seems to be that the package zip file becomes too large since unneeded prisma nodemodules are not excluded edit: I got it working with following solution, might not be the best but it works. I went through the zip file that serverless deploy generates and located the engine files that are requiring lots of space but that are not required. Then I inserted “rm” script on each of those after the prisma generate command, like so:
    custom:
    webpack:
    includeModules: true
    packagerOptions:
    scripts:
    - prisma generate
    - rm -R node_modules/@prisma/engines
    - rm -R node_modules/@prisma/engines-version
    - rm node_modules/prisma/libquery_engine-darwin.dylib.node
    - rm -R node_modules/prisma/engines
    ✅ 1
    r
    • 2
    • 4
  • p

    Peter Kellner

    11/16/2021, 6:22 PM
    How can I add to the Prisma pipeline a delay to all my sqlite requests of a couple seconds. I want to simulate a real world response time and I'd rather then not put "sleep" code all over my app.
    r
    • 2
    • 1
  • f

    febreeze

    11/16/2021, 9:48 PM
    uuhm, anyone knows how to do this? I want to upsert a table where multiple conditions match. Do i really need to search first and then update??
    a
    r
    • 3
    • 7
  • m

    Mykyta Machekhin

    11/16/2021, 10:17 PM
    Hi everybody. I once asked a similar question, but now I have to return to it, since there are huge problems on our project because of it. Tell me, is there any sane way (except for making own fork from the prisma) to disable validation for extra fields in the parameters in the mutation methods? Due to this stupid check, we are forced to write thousands of additional lines of code in each method working with the prism, in order to transfer all fields from some object to a new object in it, in which only those fields that the prisma will process are guaranteed ... Since if an object with extra fields arrives during runtime, there will be a runtime error
    r
    • 2
    • 2
  • m

    Mo El

    11/17/2021, 12:05 AM
    hey! how are folks handling validation? I have to add a validation on a date column (say, cant be more than 1 yr into the future) where `create`/`update` for that model is used all over our codebase. Any ideas for how to centralize it like a traditional ORM’s validation hooks?
    f
    h
    +3
    • 6
    • 13
  • p

    Peter Takacs

    11/17/2021, 10:38 AM
    Hi! Has anyone experienced the same using full-text search feature on Postgres? Search returns the following syntax error when the search term is more than 1 word.
    r
    • 2
    • 12
  • d

    Daniel

    11/17/2021, 11:17 AM
    Hi. I am getting the error below when trying to run
    npm build
    with an existing very simple database with two tables: node_modules/.prisma/client/index.d.ts144998 - error TS2314: Generic type ‘Keys’ requires 1 type argument(s). I have two tables,
    Keys
    and
    KeyRatios
    mapped like this (omitted trivial attributes):
    Copy code
    model KeyRatios {
      Id                Int       @id(map: “PK_KeyRatios”) @default(autoincrement())
      KeyId             Int
      Keys              Keys      @relation(fields: [KeyId], references: [Id], onDelete: Cascade, onUpdate: NoAction, map: “FK_KeyRatios_Keys_KeyId”)
    
      @@index([KeyId], map: “IX_KeyRatios_KeyId”)
    }
    
    model Keys {
      Id                        Int         @id(map: “PK_Keys”) @default(autoincrement())
      KeyRatios                 KeyRatios[]
    }
    Copy code
    1449     Keys<T extends KeysArgs = {}>(args?: Subset<T, KeysArgs>): CheckSelect<T, Prisma__KeysClient<Keys | null >, Prisma__KeysClient<KeysGetPayload<T> | null >>;
                                                                                                          ~~~~
    
    node_modules/.prisma/client/index.d.ts:2049:11 - error TS2314: Generic type 'Keys' requires 1 type argument(s).
    
    2049         ? Keys
                   ~~~~
    
    node_modules/.prisma/client/index.d.ts:2054:7 - error TS2314: Generic type 'Keys' requires 1 type argument(s).
    
    2054     ? Keys  & {
               ~~~~
    
    node_modules/.prisma/client/index.d.ts:2063:51 - error TS2314: Generic type 'Keys' requires 1 type argument(s).
    
    2063     [P in TrueKeys<S['select']>]: P extends keyof Keys ?Keys [P]
                                                           ~~~~
    
    node_modules/.prisma/client/index.d.ts:2063:57 - error TS2314: Generic type 'Keys' requires 1 type argument(s).
    
    2063     [P in TrueKeys<S['select']>]: P extends keyof Keys ?Keys [P]
                                                                 ~~~~
    
    node_modules/.prisma/client/index.d.ts:2070:7 - error TS2314: Generic type 'Keys' requires 1 type argument(s).
    
    2070     : Keys
               ~~~~
    
    node_modules/.prisma/client/index.d.ts:2071:5 - error TS2314: Generic type 'Keys' requires 1 type argument(s).
    
    2071   : Keys
             ~~~~
    
    node_modules/.prisma/client/index.d.ts:2094:132 - error TS2314: Generic type 'Keys' requires 1 type argument(s).
    
    2094     ): HasReject<GlobalRejectSettings, LocalRejectSettings, 'findUnique', 'Keys'> extends True ? CheckSelect<T, Prisma__KeysClient<Keys>, Prisma__KeysClient<KeysGetPayload<T>>> : CheckSelect<T, Prisma__KeysClient<Keys | null >, Prisma__KeysClient<KeysGetPayload<T> | null >>
                                                                                                                                            ~~~~
    
    node_modules/.prisma/client/index.d.ts:2094:214 - error TS2314: Generic type 'Keys' requires 1 type argument(s).
    
    2094     ): HasReject<GlobalRejectSettings, LocalRejectSettings, 'findUnique', 'Keys'> extends True ? CheckSelect<T, Prisma__KeysClient<Keys>, Prisma__KeysClient<KeysGetPayload<T>>> : CheckSelect<T, Prisma__KeysClient<Keys | null >, Prisma__KeysClient<KeysGetPayload<T> | null >>
                                                                                                                                                                                                                              ~~~~
    
    node_modules/.prisma/client/index.d.ts:2111:131 - error TS2314: Generic type 'Keys' requires 1 type argument(s).
    
    2111     ): HasReject<GlobalRejectSettings, LocalRejectSettings, 'findFirst', 'Keys'> extends True ? CheckSelect<T, Prisma__KeysClient<Keys>, Prisma__KeysClient<KeysGetPayload<T>>> : CheckSelect<T, Prisma__KeysClient<Keys | null >, Prisma__KeysClient<KeysGetPayload<T> | null >>
                                                                                                                                           ~~~~
    
    node_modules/.prisma/client/index.d.ts:2111:213 - error TS2314: Generic type 'Keys' requires 1 type argument(s).
    
    2111     ): HasReject<GlobalRejectSettings, LocalRejectSettings, 'findFirst', 'Keys'> extends True ? CheckSelect<T, Prisma__KeysClient<Keys>, Prisma__KeysClient<KeysGetPayload<T>>> : CheckSelect<T, Prisma__KeysClient<Keys | null >, Prisma__KeysClient<KeysGetPayload<T> | null >>
                                                                                                                                                                                                                             ~~~~
    
    node_modules/.prisma/client/index.d.ts:2131:43 - error TS2314: Generic type 'Keys' requires 1 type argument(s).
    
    2131     ): CheckSelect<T, PrismaPromise<Array<Keys>>, PrismaPromise<Array<KeysGetPayload<T>>>>
                                                   ~~~~
    
    node_modules/.prisma/client/index.d.ts:2147:42 - error TS2314: Generic type 'Keys' requires 1 type argument(s).
    
    2147     ): CheckSelect<T, Prisma__KeysClient<Keys>, Prisma__KeysClient<KeysGetPayload<T>>>
                                                  ~~~~
    
    node_modules/.prisma/client/index.d.ts:2179:42 - error TS2314: Generic type 'Keys' requires 1 type argument(s).
    
    2179     ): CheckSelect<T, Prisma__KeysClient<Keys>, Prisma__KeysClient<KeysGetPayload<T>>>
                                                  ~~~~
    
    node_modules/.prisma/client/index.d.ts:2198:42 - error TS2314: Generic type 'Keys' requires 1 type argument(s).
    
    2198     ): CheckSelect<T, Prisma__KeysClient<Keys>, Prisma__KeysClient<KeysGetPayload<T>>>
                                                  ~~~~
    
    node_modules/.prisma/client/index.d.ts:2256:42 - error TS2314: Generic type 'Keys' requires 1 type argument(s).
    
    2256     ): CheckSelect<T, Prisma__KeysClient<Keys>, Prisma__KeysClient<KeysGetPayload<T>>>
    r
    • 2
    • 4
  • k

    KJReactor

    11/17/2021, 11:50 AM
    Can someone help please? I'm facing
    SCRAM AuthenticationFiled
    issues when trying to connect to a local MongoDB replicaSet?
  • m

    Merlin G

    11/17/2021, 11:54 AM
    I'm seeing a NextJS
    target: serverless
    issue that has me baffled. I have a branch which throws this error when I run `next build`:
    Copy code
    Error: ENOENT: no such file or directory, open '/Users/<my path>/.next/serverless/chunks/schema.prisma'
    Which seems like a change to prisma, or to next which has caused the
    schema.prisma
    to go missing, except we pin our dependencies and the versions haven't changed. So what could cause this? The
    schema.prisma
    file in our repo hasn't moved, and our build scripts haven't changed either. The only changes are to some of our API and the addition of a
    tsx
    page. Happens with Prisma & client 3.2.1 and 3.5.0
  • u

    user

    11/17/2021, 11:59 AM
    Announcing the Prisma Data Proxy (Early Access)

    https://www.youtube.com/watch?v=GWbzyyziH9A▾

    In this video, you'll learn about the challenges of working with databases in serverless environments and how Prisma's Data Proxy solves them. Docs: https://www.prisma.io/docs/concepts/components/prisma-data-platform#prisma-data-proxy —————————————————— 📚 Learn more about Prisma • Website: https://www.prisma.io • Docs: https://www.prisma.io/docs • Quickstart: https://pris.ly/qstart —————————————————— ❓ Get help with Prisma issues • Slack: https://slack.prisma.io • GitHub: https://www.github.com/prisma/prisma/discussions • Stackoverflow: https://stackoverflow.com/questions/tagged/prisma —————————————————— 💬 Follow Prisma on social media • Twitter: https://twitter.com/prisma • Instagram: https://www.instagram.com/prisma.io/ • TikTok: https://www.tiktok.com/@prismadata • Facebook: https://www.facebook.com/prisma.io • LinkedIn: https://www.linkedin.com/company/prisma-io —————————————————— 🔠Professional captions for your technical videos Prisma sponsors human-reviewed, professional closed captions for ANY video valuable to our community (for example, about: Node.js, TypeScript & Type Safety, Prisma, databases, etc). Get your FREE captions here: https://pris.ly/closedcaptions —————————————————— ✅ Subscribe to Prisma's YouTube channel https://www.youtube.com/channel/UCptAHlN1gdwD89tFM3ENb6w?sub_confirmation=1
  • d

    Daniel Norman

    11/17/2021, 4:12 PM
    We’re live folks:

    https://www.youtube.com/watch?v=2uOzqjFBSEQ▾

  • d

    Dan

    11/17/2021, 4:53 PM
    Does Prisma support libpq? We are looking to provide multiple hosts (leader/replica) with
    target_session_attrs
    r
    • 2
    • 2
  • d

    Dan

    11/17/2021, 4:53 PM
    <postgresql://host1:123>,host2:456/somedb?target_session_attrs=any
  • k

    KJReactor

    11/17/2021, 5:51 PM
    I'm trying to create a write but I keep getting
    Malformed ObjectID: provided hex string representation
    error. I'm using Mongo provider and prisma 3.5.0
    r
    • 2
    • 1
  • y

    Yaakov

    11/17/2021, 7:01 PM
    Hi, I'm looking for a Prisma session store that is compatible with the express-session module. Does anyone know if @quixo3/prisma-session-store is being properly maintained, its
    README
    states that it is for Prisma 2?
  • k

    Kent C. Dodds

    11/17/2021, 7:20 PM
    Hello friends 👋 Anyone know whether it's possible to get a random row in the db via the query without pulling everything and grabbing a random one in the client/node?
    j
    p
    • 3
    • 7
  • d

    Dan

    11/17/2021, 8:26 PM
    Why should prisma’s 
    dataProxy
     service be used over 
    pg bouncer
    a
    • 2
    • 1
  • d

    Dan

    11/17/2021, 8:27 PM
    @Kent C. Dodds use a random offset?
  • d

    Dan

    11/17/2021, 8:28 PM
    https://www.prisma.io/docs/concepts/components/prisma-client/pagination#offset-pagination
  • d

    Dan

    11/17/2021, 8:28 PM
    Might require doing a count first, but just an idea
  • d

    Dan

    11/17/2021, 8:28 PM
    ah nvm, might be a bad idea: https://www.prisma.io/docs/concepts/components/prisma-client/pagination#%E2%9C%98-cons-of-offset-pagination
  • f

    febreeze

    11/17/2021, 8:56 PM
    anyone using next,js with docker and nginx? i have some problems with webpack hmr and/or SWC even tho the ports are forwarded 😞 if anyone has some knowledge of this, drop me a message, cheers.
    • 1
    • 2
  • m

    Michael Auderer

    11/18/2021, 1:37 AM
    i need to migrate a String column to Boolean (postgres), all values are either "Yes" or "No". Postgres is able to natively cast these values to Booleans, but after updating my prisma schema and running
    prisma migrate dev
    I see this: `The
    trust
    column on the
    Lead
    table would be dropped and recreated. This will lead to data loss.` Is it possible to convert this column without data loss? If I just do it in a plain SQL migration, will that mess anything up with Prisma?
    r
    • 2
    • 1
  • a

    alechko

    11/18/2021, 6:33 AM
    hi all, can anyone tell me if it’s possible to create a deeply nested entities? I’m trying to do something like seeding a user with a post and several comments with replies:
    Copy code
    await prisma.user.create({
          data: {
            email: faker.internet.email(),
            posts: {
              create: {
                title: faker.lorem.sentence(10),
                comments: {
                  create: [
                    {
                      body: faker.lorem.paragraph(10),
                      children: {
                        create: [ <--- THIS FAILS TO INHERIT THE POST
                          {
                            body: faker.lorem.paragraph(10),
                          }
                        ]
                      },
                    },
                  ],
                },
              },
            },
          },
        });
    So the
    children
    section fails because the Comment entity has a
    postId
    field, and it’s working (inheriting the post) for the parent comment but not for children comments. my comment model looks like this:
    Copy code
    model Comment {
      id          String          @id() @default(uuid()) @db.Uuid
      body        String
      createdAt   DateTime        @default(now())
      updatedAt   DateTime        @updatedAt
      deletedAt   DateTime?
    
      user        User?           @relation(fields: [userId], references: [id], onDelete: SetNull)
      userId      String?         @db.Uuid
    
      post        Post            @relation(fields: [postId], references: [id], onDelete: Cascade)
      postId      String          @db.Uuid
    
      parent      Comment?        @relation("CommentParent", fields: [parentId], references: [id])
      parentId    String?         @db.Uuid
      children    Comment[]       @relation("CommentParent")
    }
    r
    • 2
    • 4
  • d

    Dan

    11/18/2021, 8:18 AM
    Wanted to share this conversation happening about Prisma being hosted on Fly with read replicas - Would LOVE if someone from the core team could hop in and stir the pot! https://community.fly.io/t/fly-pg-read-replica-multi-region-clusters-with-prisma-node/2655
    💯 4
  • n

    Neo Lambada

    11/18/2021, 11:44 AM
  • n

    Neo Lambada

    11/18/2021, 11:44 AM
    Hi, in this schema. i’m trying to get all the products, but for each product I’m checking if the current user has like the product or not using simple subquery check
  • n

    Neo Lambada

    11/18/2021, 11:45 AM
    is this possible in prisma
  • n

    Neo Lambada

    11/18/2021, 11:45 AM
    now im using a raw query for it, so i can avoid N+1 problem. so this query will go to database in one shot right
  • n

    Neo Lambada

    11/18/2021, 11:50 AM
    r
    • 2
    • 10
1...508509510...637Latest