https://www.prisma.io/ logo
Join SlackCommunities
Powered by
# graphql-nexus
  • k

    kitze

    06/16/2020, 3:53 PM
    I'm trying to use the
    nexus-plugin-shield
    plugin but even with empty
    rules
    object I'm always getting this error:
    err JsonWebTokenError: jwt malformed
    j
    s
    +2
    • 5
    • 8
  • k

    kitze

    06/16/2020, 3:53 PM
    any ideas?
  • t

    Tyson

    06/16/2020, 6:59 PM
    Hey all - i’m trying to integrate stripe into my application and need to expose a REST endpoint for web-hooks. I’m using the
    nexus-plugin-prisma
    . How do I get access to Prisma in my post method here?
    Copy code
    <http://server.express.post|server.express.post>(
      stripeEndpoint,
      bodyParser.raw({ type: 'application/json' }),
      async (req: any, res) => {
        let event
        try {
          event = stripe.webhooks.constructEvent(
            req.rawBody,
            req.headers['stripe-signature'],
            stripeWebhookSecret
          )
        } catch (err) {
          console.log(err)
          console.log(`⚠️  Webhook signature verification failed.`)
          console.log(
            `⚠️  Check the env file and enter the correct webhook secret.`
          )
          return res.sendStatus(400)
        }
    
        // Extract the object from the event.
        const dataObject = event.data.object
        switch (event.type) {
          case 'invoice.payment_failed':
            / *** How do I access prisma here? ***/
            break
          default:
            break
        }
        res.sendStatus(200)
      }
    )
    g
    • 2
    • 3
  • s

    Sytten

    06/17/2020, 6:28 PM
    Hello! I finished a first version of a new authorization library for nexus called nexus-shield. I would really appreciate to have some feedback on it as I move it toward production-ready: https://github.com/Sytten/nexus-shield
    👍 7
    y
    d
    l
    • 4
    • 5
  • s

    Sytten

    06/19/2020, 12:16 PM
    I started an awesome repo for nexus, feel free to PR: https://github.com/Sytten/awesome-nexus
    👍 3
  • j

    jasonkuhrt

    06/19/2020, 1:46 PM
    https://twitter.com/nexusgql/status/1273974127372763137
    🎉 2
    👍 3
    s
    r
    l
    • 4
    • 7
  • p

    Peter

    06/19/2020, 3:35 PM
    Hello I try to check this example https://github.com/graphql-nexus/examples/blob/master/plugins-prisma-and-jwt-auth-and-shield/api/graphql/Mutation.ts But in playground i get
    "error": [
    {
    "message": "Cannot query field \"name\" on type \"AuthPayload\".",
    "locations": [
    {
    "line": 3,
    "column": 5
    }
    ]
    },
    {
    "message": "Cannot query field \"email\" on type \"AuthPayload\".",
    "locations": [
    {
    "line": 4,
    "column": 5
    }
    ]
    },
    {
    "message": "Cannot query field \"password\" on type \"AuthPayload\".",
    "locations": [
    {
    "line": 5,
    "column": 5
    }
    ]
    }
    ].
    j
    w
    • 3
    • 8
  • p

    Peter

    06/19/2020, 3:36 PM
    type for singup mutation is ‘AuthPayload’, but is only the type of returned values? What about input types?
  • t

    Timo

    06/20/2020, 12:27 PM
    Let's say I've got the following Schema of a
    post
    Copy code
    t.model.id()
    t.model.content()
    t.model.author({type:'Profile'})
    And
    author
    Copy code
    t.model.id()
    <http://t.model.post|t.model.post>()
    t.field('isCool', { type: 'Boolean', nullable: true })
    And I'm using prisma to return a post + author
    const post = await prisma.post.findOne({where: {id: '123'}, include: {author: true}})
    and then *I want to add another field to author inside the resolver (*`post.author.isCool = true` ) However, in reality, I will get an author with
    isCool: null
    as the
    author
    is being fetched directly from prisma. Is there anything I can do there? It kind of feels like a waste of computing space, that multiple queries are being made instead of simply
    including
    other fields and having a longer query? Or am I missing something? If I'd use
    t.field
    instead of
    t.model
    I need to add another
    resolve
    method, or I'd get
    Property 'resolve' is missing
    r
    • 2
    • 1
  • d

    DeanMo

    06/22/2020, 7:23 AM
    If anyone could help me, I have spent the better part of the last week trying to learn graphql, prisma2 and nexus. I have a pretty solid understanding of all 3 but combining it together is where I am going in loops. Ive gone through the tutorials a few times each on nexus and prisma, just getting lost on how to start a fresh project in a proper way. Id love to spend 5-10 min tops with someone who has a better understanding of those technologies better than I do and just break down where I am at right now and where I need to be going. Any and all help would be appreciated, here or via DM, thanks
    r
    • 2
    • 6
  • a

    Andrew Leung

    06/22/2020, 1:21 PM
    Hi all, I’m trying to deploy a Nexus + Prisma app to Serverless using the new Serverless Express components. I’m compiling the app on darwin, and deploying to an AWS Lambda. This implies that I will need to set the following in my prisma schema
    Copy code
    generator prisma_client {
      provider      = "prisma-client-js"
      binaryTargets = ["native", "rhel-openssl-1.0.x"]
    }
    I’m able to get the express server running on the lambda (graphql and playground endpoints are live), however when it attempt to run prisma, I get the following error:
    Copy code
    "\nInvalid `prisma.user.findMany()` invocation in\n/var/task/node_modules/nexus-prisma/dist/builder.js:202:93\n\n\n  EROFS: read-only file system, chmod '/var/task/node_modules/.prisma/client/query-engine-rhel-openssl-1.0.x'"
    This lead me to https://github.com/prisma/prisma-client-js/issues/476 which theorizes to be a Windows issue, however like I said, I’m compiling via darwin. I’m trying to understand a bit more of what’s happening under the hood here so I can see if I can’t get this deployment to work.
    r
    w
    +2
    • 5
    • 36
  • a

    Aashish Jain

    06/23/2020, 5:04 AM
    Anybody have any idea how to implement subscriptions with prisma2 + nexus? I understand prisma2 doesn’t support subscriptions yet, so i’m fine with whatever workaround people have come up with.
    r
    • 2
    • 2
  • a

    Albert Gao

    06/23/2020, 11:58 PM
    Questions 🙂 1. What’s the difference between this channel and graphql-nexus-next? 2. What’s the difference between https://www.nexusjs.org/ and https://nexus.js.org/ , is the latter one a deprecated website?
    j
    • 2
    • 2
  • a

    Aashish Jain

    06/24/2020, 2:01 AM
    Recommended way to authentication rules on different mutations, queries, fields?
    r
    • 2
    • 1
  • a

    Albert Gao

    06/24/2020, 2:33 AM
    If I use prisma 2 with nexus, for a simple GraphQL query like
    { users: {name age} company: {name id} }
    , it has two entities, will it be translated to 1 SQL statement in the end or two calls to database where one for each entity?
    r
    • 2
    • 5
  • w

    weakky

    06/24/2020, 10:11 AM
    set the channel topic: Everything about Nexus https://nexusjs.org
    💯 4
  • s

    Samrith Shankar

    06/24/2020, 10:56 PM
    Hey, I upgraded Nexus to the next version. Now whenever I start the server, I have an
    api.graphql
    file in my root directory. Any idea why?
    a
    w
    • 3
    • 10
  • a

    Albert Gao

    06/26/2020, 3:36 AM
    Is there an example of using Nexus with AWS Lambda? Thanks 🙂
    t
    • 2
    • 2
  • s

    Samrith Shankar

    06/26/2020, 9:40 AM
    Hey, I am using the latest version of Nexus and have issues with Prisma Studio. It keeps throwing an error
    Cannot read property 'response' of null
    . Anyone else facing this issue and know how to fix it?
    ✔️ 1
    r
    • 2
    • 10
  • s

    Samrith Shankar

    06/26/2020, 1:28 PM
    Is there any way to get
    request
    and
    response
    in
    schema.middleware
    ? I need it to retrieve headers from my request and parse it for my logic and if it succeeds, then return next.
    t
    e
    • 3
    • 8
  • a

    Aryeh

    06/29/2020, 4:45 AM
    Hey all, I’ve been thinking a lot about error handling in graphql. The approach I want to take in my project is to define potential errors as a “result” for a field. I would have interfaces describing the potential return types, and then unioning all of them together for the payload. See these articles for more info: LogRocket article, blog article My question is, with nexus plugin prisma, if you do auto crud, is there a way to pass to nexus this union type I’d be making as the return type instead of the default type that nexus gets from prisma? Is there a way to pass a custom return type defined with nexus code for the return types of both query and mutation fields?
    👍 2
    r
    j
    • 3
    • 17
  • d

    DeanMo

    06/29/2020, 5:22 PM
    I am new to development, spent the last month or so doing Vue, NestJS and just basic postgres. Now that I am learning graphql, prisma and nexus, I really like how all 3 work together. Unfortunately it has been a bit difficult geting graphql, prisma and nexus working good in NestJS. Instead of nest, does anyone have a recommendation for something to explore? Sorry if too basic of a question.
    r
    • 2
    • 20
  • d

    DeanMo

    06/29/2020, 5:23 PM
    nestjs works fine with typegraph ql, but I really like how nexus works. Not sure if I should just learn typegraph or find something else instead of nest.
  • a

    andykay

    06/30/2020, 4:32 PM
    Hi I'm trying to get Nexus setup for serverless but it's telling me I don't have any types
    Copy code
    nexus:schema Your GraphQL schema is empty. This is normal if you have not defined any GraphQL types yet. If you did however, check that your files are contained in the same directory specified in the `rootDir` property of your tsconfig.json file.
    j
    • 2
    • 23
  • a

    Alex Vilchis

    07/01/2020, 2:51 AM
    Hi there, is there an easy way to create generate all type files (in
    graphql/
    ) from my
    schema.prisma
    file?
    b
    • 2
    • 1
  • m

    mikkelsl

    07/02/2020, 5:47 AM
    How do I make sure that NexusContext in resolvers understand the types of
    req
    ,
    res
    and
    session
    in order to get autocomplete and accurate type safety?
    Copy code
    schema.addToContext(() => ({ req, res, session }))
    When I use ctx to access session (jwt) data like f.i.:
    Copy code
    ctx.db.address.findMany({ where: { organizerId: { equals: ctx.session.organizerId } } })
    r
    j
    • 3
    • 6
  • p

    Peter

    07/02/2020, 4:29 PM
    I have been testing this example and wondering how I should pass token in playground.
  • p

    Peter

    07/02/2020, 4:30 PM
    I try pass in header but without success 😔
    l
    • 2
    • 2
  • t

    Taras Protchenko

    07/03/2020, 2:30 PM
    Hello! I faced this issue - `Warning: Your GraphQL 'ChapterLink' object definition is attempting to expose a Prisma model field called
    id
    , but your Prisma model 'ChapterLink' has no such field.` I think it connected with multi-field id. My code:
    Copy code
    objectType({
      name: 'ChapterLink',
      definition(t) {
        t.model.id()
        t.model.title()
        t.model.createdAt()
        t.model.updatedAt()
        t.model.fromChapter()
        t.model.fromId()
        t.model.toChapter()
        t.model.toId()
      },
    })
    
    ====
    
    model ChapterLink {
      title       String
      fromChapter Chapter? @relation(name: "ChapterToChapterLink_fromChapter", fields: [fromId], references: [id])
      fromId      String?
      toChapter   Chapter? @relation(name: "ChapterToChapterLink_toChapter", fields: [toId], references: [id])
      toId        String?
      createdAt   DateTime @default(now())
      updatedAt   DateTime @updatedAt
    
      @@id([fromId, toId])
    }
    Copy code
    "nexus-plugin-prisma": "^0.16.1",
    ✔️ 1
    • 1
    • 1
  • a

    Alex Vilchis

    07/04/2020, 8:11 AM
    Hi! Has anyone managed to use graphql-codegen with Nexus Framework? I am getting an error:
    invalid json response body at <http://localhost:4000/> reason: Unexpected token < in JSON at position 0
    r
    • 2
    • 3
1...567...25Latest