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

    halborg

    06/20/2018, 8:15 AM
    Hey all 🙂 Our team badly needs help with the problem I describe here: https://www.prisma.io/forum/t/how-to-handle-info-in-an-app-schema-with-additional-datatypes-than-db-schema/3800 TL;DR - If we have an app schema with types that are not present in the DB schema, how do we use the
    info
    object in our resolvers? We can’t pass it on unmodified, as the AST would not match the DB schema. I can’t find any examples or documentation about it, and it seems to me to be a main component of Prisma that the app schema and DB schema are separated and can evolve separately, so there must be some better way than to do string manipulation, right?
    a
    • 2
    • 11
  • d

    Darryl

    06/20/2018, 8:59 AM
    Hi, everyone. I’m playing around with GraphQL (and Prisma) for the first time and I have a question. What’s wrong here? The idea is that a book can be created and have an array of versions, each of which is a particular shape (it has a name and a publish date). Is this the wrong way to approach it?
    Copy code
    type Book @model {
      id: ID! @unique
      name: String!
      versions: [Version!]!
    }
    
    type Version {
      name: String!
      publishDate: String!
    }
  • d

    Darryl

    06/20/2018, 8:59 AM
    I know I could just have the book versions as an array of strings but I’m looking for some type safety to ensure the versions are of a particular shape.
  • d

    Darryl

    06/20/2018, 9:01 AM
    When deployed, and I try to create a book, I’m not quite sure how to enter the versions array. I figured it might be like this but apparently not.
    Copy code
    mutation CreateBook {
      createBook(data: {
        name: "Some book"
        versions: [
          { name: "..." publishDate: "..." }
          { name: "..." publishDate: "..." }
        ]
      }) {
        id
      }
    }
    w
    n
    • 3
    • 4
  • m

    Moritz

    06/20/2018, 9:08 AM
    Hi everyone, I have been trying to get an answer for the past couple of days, but nobody has been responding 🤒 How does the prisma/yoga server handle hanging subscriptions? I have a local server instance runnning with a react native client attached. When I subscribe to a subscription, everything works fine. However, when I reload my app and subscribe again, the subscription updates are not received any more. How does prisma/yoga react, when the subscription websocket connection is simply broken, and a new one is established a few seconds later? is it possible that server side caching is causing this behavior? Thanks, I would really like to understand whats going on here, we switched back to polling because we cannot figure out how this behavior is caused. Would be glad about any feedback!
    n
    • 2
    • 6
  • d

    Darryl

    06/20/2018, 9:32 AM
    Is it possible, when doing an update mutation, to keep the value that’s already there but add to it. For example, if there’s a list and you want to do an update to add something. I’ve checked the schema and can’t see anything about keeping what’s already stored.
    n
    • 2
    • 4
  • m

    Moritz

    06/20/2018, 9:44 AM
    Hi, where in my yoga server should I check for an auth header, if I want to do so before all queries/mutations? I remember there being an awesome permission lib for prisma, can someone remind me what its called?
    m
    e
    • 3
    • 3
  • m

    mop

    06/20/2018, 10:52 AM
    I just hacked graphql playground to support aws appsync (including subscriptions). maybe somebody finds that helpful: https://github.com/m0ppers/graphql-playground/tree/aws-appsync-support/packages/graphql-playground-electron . not sure if it is worthwhile to create a pull request...
    👍 1
    h
    • 2
    • 1
  • m

    mop

    06/20/2018, 10:53 AM
    and I still wonder: graphql playground seems cool. is nobody using appsync with subscriptions? there is virtually no tooling/support out there...how are people developing stuff?
    h
    a
    p
    • 4
    • 3
  • l

    lewisblackwood

    06/20/2018, 11:07 AM
    Is there a way to disable the
    prisma seed
    CLI command for a particular Prisma service? It's helpful for our local development service, but I don't want it to be enabled for our staging/production services.
    e
    • 2
    • 5
  • e

    eelke

    06/20/2018, 1:31 PM
    Does anybody know why a relationship in Prisma has to be modelled like this:
    Copy code
    foos: [Foo!]!
      bars: [Bar]
    and not like this:
    Copy code
    foos: [Foo]!
      bars: [Bar]!
    (I like the latter because then I know it'll always be an array which I can then
    map
    over)
  • e

    eelke

    06/20/2018, 1:31 PM
    https://www.prisma.io/docs/reference/service-configuration/data-model/data-modelling-(sdl)-eiroozae8u/#required-relations
    Note that a to-many relation field is always set to required. For example, a field that contains many user addresses always uses the type [Address!]! and can never be of type [Address!]. The reason is that in case the field doesn't contain any nodes, [] will be returned, which is not null.
    a
    a
    • 3
    • 7
  • e

    eelke

    06/20/2018, 1:32 PM
    I am not sure, but this seems related
  • t

    theom

    06/20/2018, 2:19 PM
    @nilan Is anyone looking at this issue? https://github.com/graphql-boilerplates/react-fullstack-graphql/issues/393
    n
    • 2
    • 1
  • s

    siyfion

    06/20/2018, 2:50 PM
    @nilan @nikolasburk @tim2 Think I’ve found a pretty nasty bug here… We have a
    User
    type with a many-to-many relationship defined with a
    Tag
    type. The
    createUser
    and
    updateUser
    allow us to specify
    tags: { connection: [ { id: "..." }, { id: "..." } ] }
    which will create a relationship between the user and the specified tags (via
    id
    ). However, when we use
    upsertUser
    and do the same, it runs successfully but NONE of the connections/relationships are created.
    w
    n
    m
    • 4
    • 11
  • s

    siyfion

    06/20/2018, 2:52 PM
    Surely it should either error, or create the relationships?
  • p

    peter

    06/20/2018, 3:08 PM
    regarding
    graphql-import
    , is there an extra cost to importing all types (
    import * from "./generated/prisma.graphql"
    ) vs selectively importing specific types?
    t
    • 2
    • 2
  • j

    johhansantana

    06/20/2018, 4:17 PM
    is there a guide on updating your current prisma project?
    n
    • 2
    • 2
  • a

    Arnab

    06/20/2018, 4:40 PM
    Currently playing around with prisma, and postgres. I am wondering why the psql database shows the following:
    Copy code
    prisma=# \d
    Did not find any relations.
    I have set up the following types and inserted one object of type `Speaker`:
    Copy code
    type Speaker {
      id: ID! @unique
      firstname: String!
      lastname: String!
      email: String
    }
    
    type Talk {
      id: ID! @unique
      speaker: Speaker!
      description: String
      title: String
    }
  • a

    Arnab

    06/20/2018, 5:15 PM
    I tried the same thing in mysql and similarly could only find the following:
    Copy code
    mysql> show tables;
    +-------------------+
    | Tables_in_prisma  |
    +-------------------+
    | InternalMigration |
    | Migration         |
    | Project           |
    | TelemetryInfo     |
    +-------------------+
    4 rows in set (0.00 sec)
    n
    • 2
    • 19
  • j

    jaybauer

    06/20/2018, 5:58 PM
    I’m getting an error in my playground that I can’t seem to resolve. I’ve tried running
    prisma cluster logs
    and nothing shows up, it just says
    Attaching to
    and then stops without an error. This is only happening for one specific mutation, most work fine. I’ve tried nuking my cluster after I saw some people were having a similar issue a few months ago, but to no avail. I’m running prisma v1.7
  • r

    ryannealmes

    06/20/2018, 7:26 PM
    Can someone please help 🙂 I have spent about a day trying to figure out how to pass context from a graphql server to a remoteExecutable schema. I just can’t figure it out! In the prisma blog, I follow the example
    Copy code
    const fetch = require('node-fetch')
    const { makeRemoteExecutableSchema, introspectSchema } = require('graphql-tools')
    const { GraphQLServer } = require('graphql-yoga')
    const { createHttpLink } = require('apollo-link-http')
    
    const { DATABASE_SERVICE_ID } = require('./services')
    
    async function run() {
      // 1. Create Apollo Link that's connected to the underlying GraphQL API
      const makeDatabaseServiceLink = () => createHttpLink({
        uri: `<https://api.graph.cool/simple/v1/${DATABASE_SERVICE_ID}>`,
        fetch
      })
    
      // 2. Retrieve schema definition of the underlying GraphQL API
      const databaseServiceSchemaDefinition = await introspectSchema(makeDatabaseServiceLink())
    
      // 3. Create the executable schema based on schema definition and Apollo Link
      const databaseServiceExecutableSchema = makeRemoteExecutableSchema({
        schema: databaseServiceSchemaDefinition,
        link: makeDatabaseServiceLink()
      })
    
      // 4. Create and start proxy server based on the executable schema
      const server = new GraphQLServer({ schema: databaseServiceExecutableSchema })
      server.start(() => console.log('Server is running on <http://localhost:4000'>))
    }
    
    run()
    But it doesn’t seem like the context is passed to the external service. Any ideas? I have read the apollo docs, and I sort of get it, but I can’t figure it out
    l
    n
    • 3
    • 8
  • k

    Klaus Breyer

    06/20/2018, 7:53 PM
    hi i'm on my first graph.cool application right now. i wonder how i can restrict certain queries? so i don't want everyone to be able to query allusers for example. i am using the hosted version at console.graph.cool
  • r

    ryannealmes

    06/20/2018, 11:33 PM
    Hey guys I have been working on a prisma microservicey architecture thing. Leverages schema stitching and has authentication. If anyone wants to check it our and tear it to shreds feel free to. https://github.com/ryannealmes/shakra Looking to learn. The docs still need work so please forgive. There is also an issue which you can use for discussion https://github.com/prismagraphql/prisma/issues/2404
    👍 1
    gucci 1
  • m

    mikedklein

    06/21/2018, 12:28 AM
    does anyone have any resources/articles on deploying end to end deployment using docker with apollo/yoga/prisma/postgres. I started with the boiler plate docker compose and would like to move on from there.
  • n

    nick

    06/21/2018, 4:29 AM
    Is anyone working on graphql-request cross-fetch bundling issue with webpack https://github.com/prismagraphql/graphql-request/issues/85
  • s

    sweekar

    06/21/2018, 6:46 AM
    hi folks i have been trying to do prisma introspect for postgres however what i am seeing is its always picking the public schema is it a known issue
    a
    n
    • 3
    • 8
  • c

    Christian

    06/21/2018, 8:10 AM
    I am getting
    Whoops. Looks like an internal server error.
    on
    eu4
    , anyone else having problems?
    n
    • 2
    • 6
  • z

    zonofthor

    06/21/2018, 9:26 AM
    is it possible to toggle boolean value in mutation, without fetching current state first, something like
    Copy code
    isVisible: !isVisible
    n
    • 2
    • 1
  • s

    sweekar

    06/21/2018, 9:54 AM
    Even i am getting the permission denied error i am using the latest prisma release 1.10
1...626364...637Latest