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

    Awey

    07/21/2020, 11:03 PM
    tried searching for it on the docs but I can't seem to find it.
  • j

    Javanie Campbell

    07/22/2020, 12:47 PM
    Hey guys can anyone tell me if the windows support has been patched for Nexus, can we now develop on windows with Nexus?
    r
    • 2
    • 1
  • m

    Michael Gardner

    07/22/2020, 4:23 PM
    hi all. im trying to resolve an issue with the recent release (
    @prisma/client@2.3
    )  with 
    nexus
     . i’ve narrowed it down to the package 
    nexus-plugin-prisma@0.16.1
     using an older version of prisma (
    @prisma/client@2.1.3
    ) as a dependency, causing a conflict between the the two versions due to naming convention changes in the recent releases. As far as I know, I cannot change the version in 
    npx
     because that always get the latest version of 
    @prisma/client
    , which means i need to figure out a way to bump the version in 
    nexus-plugin-prisma
    ? Any suggestions?
    j
    e
    • 3
    • 7
  • a

    Awey

    07/23/2020, 2:35 PM
    Any idea why in my
    nexus
    resolver when I try using the prisma crud operations, its showing my outdated fields from my
    prisma.schema
    even though I've run the
    save and up
    commands after changing and restarted nexus? It doesn't seem to have recognized the updated schema.
    r
    • 2
    • 7
  • d

    DeanMo

    07/23/2020, 8:57 PM
    Hey all, been stuck mentally the last week or so. If someone has a minute or two, would love to chat here or in dm's. https://www.howtographql.com/graphql-js/5-connecting-server-and-database/ trying to get nexus going and I just get confused once resolvers come into play. Not even sure why. I have done the tutorials on prisma and on nexus, gone through example repos, just something is holding it from clicking. Figured id reach out for help. This morning I did the video for prisma day with nexus, and that got me more along the way. Now trying to go and do this project with what I "learned" but seemingly havent
  • r

    ryan

    07/24/2020, 1:21 AM
    hey @DeanMo! I'd be happy to help you out. What is the blocker you're hitting?
    👀 1
    d
    • 2
    • 22
  • l

    luhagel

    07/24/2020, 9:20 AM
    Heya, is there a way to get the
    FieldResolver
    out of the
    nexus
    package? Currently transitioning from
    @nexus/schema
    and I can't really find it
    r
    • 2
    • 2
  • p

    Peter

    07/24/2020, 10:41 AM
    How I should handle scalar date type in args mutation?
    Copy code
    args: {
            startData: schema.scalarType()
          },
    in model I have
    Copy code
    model x {
      id          String            @id @default(uuid())
      startDate   DateTime
    }
    It is possible to import from prisma somehow enum types also?
    r
    • 2
    • 2
  • m

    Michael

    07/25/2020, 3:22 PM
    I need to store some pictures in a prisma2/nexus-schema/apollo project. can someone recommend a file server solution for that stack?
  • m

    Michael

    07/26/2020, 7:14 AM
    I'm generating nexus types from a prisma2 schema with the
    create-nexus-type
    CLI. Works nice so far. Now I want to add some file uploads and I wonder how that fits together. I found this reference, which I'm trying to follow. The generated CRUD assumes that there's a mapping from the input to the output types. But with the file upload, this pattern is broken as far as I can see. The input type will be some
    Upload
    scalar and the output type some custom
    File
    type. does this make sense? does anyone have a hint for me how to handle this?
  • m

    Michael

    07/26/2020, 7:17 AM
    well, actually now completely right. yes types are generated with the above tool. the CRUD (more critical here) is computed by
    addCrudResolvers
    from the react-admin data provider.
  • j

    jferrettiboke

    07/26/2020, 11:18 AM
    Does anyone have any issue running
    nexus dev
    on Windows? Context: https://github.com/graphql-nexus/nexus/issues/1277
    j
    • 2
    • 37
  • j

    Janus Reith

    07/26/2020, 1:48 PM
    Hi, I’m currently evaluating how prisma 2 would fit into a graphql api service, and so far things don’t really add up for me. Every definiton should be put into that single schema.prisma file and can’t be split up, composed or imported at runtime, is that right? I had high expectations on the GraphQL integration, to avoid lot’s of repetitive code for CRUD operations. With prisma 2 this seems to not be part of prisma anymore, which I think is fine in general, but instead everything I found points to the use nexus/nexus schema (a bit confusing there aswell with the schema/api server splitup + old website) and I got the impression that the two projects prisma and nexus are close somehow. But looking at nexus-plugin-prisma and related examples I found, everything was really verbose and all the prisma definitions had to be done again for nexus, making me question the actual convenience of having an integration between them at all. While there is some pinned issue regarding exposing fields, which mainly suggests that this would be a bad thing as it is unsafe, and discusses allowing it for getting started and not production use, I completely fail to see the logic here, why restricting access, maybe omiting some fields here and there which should not be exposed, should result in the whole type definiton being done twice. On another hand, I also wonder where authentication should be handled here in general. I understand that prisma itself mainly handles the database abstraction and doesn’t care about an api since v2, but still I think the general considerations I have when approaching this topic would be those of many, and right know I’m really confused. My main usecase would be, to have an Apollo Server(using Federation and a serverless deployment, but let’s skip this for now) , abstract away the database (hopefully soon with mongodb support) and write my type definitons once, same for some basic CRUD operations, and plug in my way of authorization/authentciation at some point do allow/deny things. This seemed like a really typical usecase to me, and TBH I didn’t took a deep dive into Prisma and Nexus yet, but I’m really wondering why some things are the way they are. Are some assumptions I had wrong, or am I maybe missing some important parts on how this integrates? I appreciate any input, thanks!
    j
    a
    • 3
    • 10
  • a

    Awey

    07/26/2020, 7:54 PM

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

    Looking at this video you have to setup an express app and create a
    refresh_token
    end point. Since nexus is using express under the hood, is this possible as well?
    r
    • 2
    • 1
  • p

    Peter

    07/27/2020, 8:57 AM
    On prisma we have include and select to choose fields we want to add. How I should extend some fields in objectType in nexus? In that type?
    Copy code
    t.field('user', { type: 'User' })
    r
    • 2
    • 2
  • p

    Peter

    07/27/2020, 1:41 PM
    How to add args to extendType? I try to add
    Copy code
    schema.extendType({
      type: 'Query',
      args: { id: intArg('id of the user') },
      definition(t) {
       ...
      },
    })
    but a get error
    Copy code
    Argument of type '{ type: "Query"; args: { id: any; }; definition(t: OutputDefinitionBlock<"Query">): void; }' is not assignable to parameter of type 'NexusExtendTypeConfig<"Query">'.
      Object literal may only specify known properties, and 'args' does not exist in type 'NexusExtendTypeConfig<"Query">'
    r
    • 2
    • 8
  • p

    Philip

    07/28/2020, 12:17 PM
    hello, I am unable to build on these versions
    r
    j
    j
    • 4
    • 22
  • j

    John M

    07/29/2020, 3:07 PM
    Hello! I'm looking for some general guidance on how/where to add business logic when using
    nexus-prisma
    , so I'm curious to hear what others have done. Do you do everything in graphql middleware? Do you implement the
    resolve
    function in the resolver of a mutation? Are you using Prisma Client's new support for middleware? What works for you? I'm thinking about things like user permissions, complex validation logic, performing side effects, and so on. Thank you!!
    b
    • 2
    • 3
  • a

    Awey

    07/30/2020, 8:21 PM
    Am I not using the
    update
    correctly?
    Copy code
    schema.inputObjectType({
      name: 'UpdateProjectInput',
      definition(t) {
        t.string('projectId', { required: true })
        t.string('name')
        t.string('description')
      },
    })
    Copy code
    t.field('updateProject', {
          type: 'Project',
          nullable: false,
          args: {
            data: schema.arg({ type: 'UpdateProjectInput', required: true }),
          },
          resolve(_root, args, ctx) {
            return ctx.db.project.update({
              where: {
                id: args.data.projectId,
              },
              data: {
                name: args.data.name,
                description: args.data.description,
              },
            })
          },
        })
    Copy code
    model Project {
      id          String   @id @default(uuid())
      name        String
      description String?
      columns     Column[]
    }
    Inside the
    data
    object, I keep getting this error for the
    name
    field.
    Copy code
    Type 'string | null | undefined' is not assignable to type 'string | undefined'.
      Type 'null' is not assignable to type 'string | undefined'.ts(2322)
    index.d.ts(1771, 3): The expected type comes from property 'name' which is declared here on type 'ProjectUpdateInput'
    r
    • 2
    • 5
  • m

    Munkhtegsh Munkhbat

    08/02/2020, 5:25 PM
    Hey guys, Autocompletion feature is not working for my Context which delivers the auto generated Prisma functionalities. I was able to use GraphQL Playground to test my query and mutations successfully, but do not see the CRUD functionality that auto generated by the Prisma in the browser either. What am I missing here?
    r
    • 2
    • 4
  • b

    bntzio

    08/02/2020, 7:28 PM
    Hello! I’m having an issue when creating a mutation, does anyone knows what may be happening? Here’s the code:
    Copy code
    t.field('createJobPost', {
          type: 'JobPost',
          args: {
            title: stringArg({ nullable: false }),
            logo: stringArg({ nullable: false })
          },
          resolve: (_, { title, logo }): any => {
            return prisma.jobPost.create({
              data: {
                title,
                logo
              }
            })
          }
        })
    r
    • 2
    • 2
  • b

    bkrausz

    08/03/2020, 5:53 PM
    👋 does anyone know what nexus-plugin-shield mean when it says “fragments not supported”? Do they mean query fragments will be ignored (which would be a really major gap/problem), or fragments in rules?
    r
    s
    • 3
    • 2
  • a

    Awey

    08/05/2020, 12:28 AM
    Somedays I feel like I understand how the prisma api works, other days I don't... It's frustrating. Given a schema that looks like this.
    Copy code
    model Project {
      id          String   @id @default(uuid())
      name        String   @unique
      description String?
      columns     Column[]
    }
    Why would this resolver have issues with types?

    https://i.postimg.cc/rsnQkvkx/Screen-Shot-2020-08-04-at-6-28-09-PM.png▾

    r
    w
    • 3
    • 3
  • m

    mikkelsl

    08/05/2020, 7:01 AM
    I'm running nexus dev, then using the api through a next dev app. Initially I get 5 connections after signing in to my app, which increases to 7-8. Then after maybe 5-10 minutes, another 5 -> 7-8 connections stack up. Are there any resources on how to interpret and/or handle this for someone who doesn't know a lot about this?
    r
    t
    +2
    • 5
    • 11
  • m

    mikkelsl

    08/05/2020, 10:59 AM
    I can access both
    prisma/.env
    and
    .env
    via
    nexus dev
    , but after running
    nexus build
    and then
    node .nexus/build
    , the build won't recognize env variables. Is there a way to achieve this?
    r
    • 2
    • 1
  • m

    Meiri Anto

    08/05/2020, 6:45 PM
    I'm running a Nexus GraphQL server, and I want to send magic links for users via email for authentication, so they would need to access a GraphQL mutation endpoint called something like
    loginWithMagicLink
    via just clicking the URL from the email. Is it possible to do a GraphQL mutation request via just a URL? or are only queries allowed?
    r
    • 2
    • 1
  • p

    Pieter

    08/05/2020, 7:34 PM
    Hi, I am having an issue switching to prisma. I got a postgres db. We've been using it with sequelize but I am trying to switch to prisma 2. All our tables are camelCase and plurals. e.g. 
    companies
     or 
    userProfiles
     table. When I run 
    prisma introspect
      it generates models that matches the table names, which results in 
    nexus
     generating "singular" and plural typings for the models, both being the actual table and model names (plural) so it results in duplicates in the typescript typings which means code doesn't compile. I got over 3000 lines generated by prisma introspect and there's no proper intellisense to rename a model and all fields related to it
    d
    • 2
    • 4
  • p

    Pieter

    08/06/2020, 8:04 AM
    Typings seem broken in @nexus/schema https://github.com/graphql-nexus/schema/issues/480
    j
    • 2
    • 6
  • m

    Michael Gardner

    08/06/2020, 4:30 PM
    hey all, i started this discussion yesterday on the repo but wanted to post it here to see if anyone can help out https://github.com/graphql-nexus/nexus/discussions/1330
  • m

    Michael Gardner

    08/06/2020, 4:33 PM
    it’s basically when you are using
    t.crud
    and put your own logic in the resolve the args’s types don’t match up with the requirements of the database from the
    context
    . I’ve gone through and set the args myself then and tell them
    {nullable: false}
    and null still appears as an option for the typing on arguments being passed in. Any suggestions how to correct this behavior?
    r
    • 2
    • 1
1...789...25Latest