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

    adubs

    07/13/2019, 1:38 AM
    Hello, was wondering if I could get some clarification… when using Graphql as the server for Prisma, do I have to simultaneously continue to update the graphql schema and the prisma schema independently?
    h
    o
    • 3
    • 5
  • h

    Habbey

    07/13/2019, 10:38 AM
    My understanding concerning deploying a graphQl app built with primsa is that i’ll deploy the prisma server first and then deploy the graphQl server, i would like to know if this is right. Pls anyone that can help. I’m in a bit of confusion
  • e

    ericsonluciano

    07/13/2019, 5:06 PM
    Hi everyone i have question it is good to seperate the type for
    User
    and
    Promoter
    ? or should i add a role:
    User
    then add enum with USER, PROMOTER? what is a good? since i need a condition that user can't mutation in type of
    Events
  • w

    Wagner D'Amaral

    07/14/2019, 12:49 AM
    Hello everyone. I'm having trouble with one application I'm playing with. I've created a resolver for User, which has a limitation on email. The idea is to use fragments. Basically, I'm not being able to see the email of the user if I don't send the id through the query. I think I have configured all steps to implement fragments however, without successfully seeing the email. My
    User
    resolver is this
    Copy code
    import getUserId from '../utils/getUserId'
    
    const User = {
        email: {
            fragment: 'fragment userId on User { id }',
            resolve(parent, args, {
                request
            }, info) {
                const userId = getUserId(request, false)
                console.log(userId) //here I can see the id of the logged user
                console.log(parent.id) // here I see UNDEFINED
                if (userId && userId === parent.id) {
                    return parent.email
                }
                return null
            }
        }
    }
    
    export {
        User as
        default
    }
    My `server.js`:
    Copy code
    import {
        GraphQLServer,
        PubSub
    } from 'graphql-yoga'
    import {
        resolvers,
        fragmentReplacements
    } from './resolvers/index'
    import prisma from './prisma'
    
    const pubsub = new PubSub()
    
    const server = new GraphQLServer({
        typeDefs: './src/schema.graphql',
        resolvers,
        context(request) {
            return {
                pubsub,
                prisma,
                request
            }
        },
        fragmentReplacements
    })
    console.log(fragmentReplacements) //Here I can see that the application is picking up the fragments
    export {
        server as
        default
    }
    Finally, my
    User
    query:
    Copy code
    users(parent, args, {
            prisma
        }, info) {
    
            const opArgs = {
                first: args.first,
                skip: args.skip,
                after: args.after,
                orderBy: args.orderBy
            }
    
            if (args.query) {
                opArgs.where = {
                    OR: [{
                        name_contains: args.query
                    }]
                }
            }
    
            return prisma.query.users(opArgs, info)
        },
    I'm using "graphql": "^14.3.1", "graphql-cli": "^3.0.11", "graphql-yoga": "^1.17.4", and prisma 1.34 Does anybody have any clue on what could be the issue?
  • i

    Imran

    07/14/2019, 8:50 AM
    Hello guys, I am building a REST api with Express.js, MongoDB and Prisma. I have a datamodel like below image. What I want is, when I go to
    /users
    route I will get data like below
    Copy code
    [
      {
        id: 'alksdf', 
        email: '<mailto:email@email.com|email@email.com>', 
        name: 'my name', 
        posts: [
          {
            id: "asldfasdfkl", 
            title: 'title', 
            content: 'content here'
          }
        ]
      }
    ]
    Actually I mean the nested query here. All the posts an user have will be inside the user Object. How can I do this? I can get this with graphql, but I want it with REST api. I am fairly new in Prisma and I don't get any good docs on REST api. Thank you
  • j

    jamiehalvorson

    07/14/2019, 10:29 AM
    👋 I’ve already posted this on Spectrum but just wondering if others have come across the same issue. When upgrading from
    1.26
    to
    1.34
    and after running
    prisma introspect
    and updating the datamodel I’m getting the following error:
    Copy code
    ▸    The Migration failed and has not been performed. This is very
     ▸    likely not a transient issue.
     ▸    java.sql.SQLSyntaxErrorException: (conn=183) Table
     ▸    '_ProgrammeClassToProgrammeWeek' already exists
    Spectrum link: https://spectrum.chat/prisma/general/upgrading-to-1-34-1-the-migration-failed-and-has-not-been-performed~c713d1c8-916e-429c-af84-a44c65f8cf5e Any pointers would be greatly appreciated, thanks!
  • f

    fandy

    07/14/2019, 5:33 PM
    👋 New to Prisma, but the docs suggest that you can create datamodel types without requiring an
    ID
    https://www.prisma.io/docs/1.34/datamodel-and-migrations/datamodel-POSTGRES-knum/#fields
    a
    • 2
    • 7
  • f

    fandy

    07/14/2019, 5:33 PM
    however, in practice Prisma throws an error saying that ID is missing
  • f

    fandy

    07/14/2019, 5:34 PM
    Copy code
    type AuthResponse {
      token: String
    }
  • f

    fandy

    07/14/2019, 5:34 PM
    Copy code
    Errors:
    
      AuthResponse
        ✖ One field of the type `AuthResponse` must be marked as the id field with the `@id` directive.
  • i

    Imran

    07/15/2019, 3:10 AM
    https://stackoverflow.com/questions/57027319/how-to-query-nested-data-in-a-rest-api-built-with-prisma
  • r

    Ragupathy Jayaraj

    07/15/2019, 7:09 AM
    Hi,
  • r

    Ragupathy Jayaraj

    07/15/2019, 7:10 AM
    Is timescaledb officially supported by prisma. There is an open issue https://github.com/prisma/prisma/issues/1672 but it does not conclude on this topic.
  • s

    Syed Ali Zaidi

    07/15/2019, 8:21 AM
    Hi guys i am having a problem need a solution: i want to create apollo client for multiple endpoints apis mean i have 3 methods and each of them need different uri (endpoint) when first uri created then how to create other one
    a
    • 2
    • 3
  • g

    gem

    07/15/2019, 8:59 AM
    does anyone has successfuly setup CI with heroku release phase & prisma deploy ?
    a
    • 2
    • 3
  • r

    rooneyK

    07/15/2019, 1:01 PM
    Hi, everyone. I was wondering if somebody could point in the right direction of resolving an issue I have. I am attempting to rewrite the arguments of a nested field. For instance, with the following query:
    Copy code
    graphql
    query{
      albums{
        files{
          id
        }
      }
    }
    I would like to rewrite it in the resolver with some arguments added to the nested field
    files
    , resulting in something like the following
    Copy code
    graphql
    
    query{
      albums{
        files(where: {archiveAt: null}){
          id
        }
      }
    }
    I tried using
    Copy code
    addFragmentToInfo(
            info,
            'fragment EnsureOnlyArchived on Album { files(where: {archived: null}) }'
          )
    I tried traversing and modifying the info-object manually, but gave up since it did not feel very clean. Is there something like
    addFragmentToInfo
    that lets me inject variabled into the nested query?
    k
    • 2
    • 1
  • c

    cmckinstry

    07/15/2019, 1:55 PM
    Hi! Quick question and lemme know if this is the wrong place to ask. Suppose I have a database and I want to place my datamodel under a specific db-schema (so in essence you get
    myschema.datamodel
    ). Is there any way to do this with the current version of prisma?
  • s

    Sam

    07/16/2019, 2:13 AM
    So I'm trying to push my little prisma demo to Heroku. I tried following the Prisma + Heroku tutorial, but was confused because my project isn't new, so I didn't run
    prisma init
    . https://www.prisma.io/blog/heroku-integration-homihof6eifi How do I push an existing Prisma project to heroku?
    prisma deploy
    generates things locally, which was good. Should update config in
    prisma.yml
    ?
  • d

    Darryl

    07/16/2019, 3:07 AM
    Are there any tutorials on how to best migrate to Prisma 2 from a current nexus-prisma project?
  • s

    Sohail Khan

    07/16/2019, 4:00 AM
    anyone on please help me
  • c

    Chris Wilson

    07/16/2019, 9:24 AM
    Hi, am I OK asking a question about the Prisma JavaScript API in here?
  • c

    Chris Wilson

    07/16/2019, 9:31 AM
    Taking silence as a yes 🙂 I'm trying to update a field that is a string array (scalarList) using the javascript client, but seem to be getting nowhere. Switching the database to debug seems to say that the data is being stripped out. javasctipt: var data = {}; data['actors'] = new Set(); data['actors'].add("test name"); const res = db.mutation.updateMedia({ where: { externalId: 1 }, data: data}); datamodel: type Media { id: ID! @unique @id title: String! actors: [String] @scalarList(strategy: RELATION) }
    j
    • 2
    • 1
  • c

    Chris Wilson

    07/16/2019, 9:32 AM
    I'm assuming that I need to set the data in a different way, but I'm a bit stumped as to how
  • a

    Andre Coetzee

    07/16/2019, 9:49 AM
    Anybody here have tried to use graphqlgen with apollo federation? Grahpqlgen has issues with the federated directives
  • m

    Michal Svrcek

    07/16/2019, 12:42 PM
    Anybody having issues with prisma deploy? It deployes changes to db, but no typescript codegen is changed and when I checked logs, it's reporting some issue with Prometheus
    Copy code
    Push to Prometheus Gateway failed with:
    2019-07-16T12:37:43.696613+00:00 app[web.1]: com.prisma.akkautil.http.FailedResponseCodeError: Server responded with 502
    2019-07-16T12:37:43.696702+00:00 app[web.1]: at com.prisma.akkautil.http.SimpleHttpClient.$anonfun$execute$4(SimpleHttpClient.scala:107)
    2019-07-16T12:37:43.696707+00:00 app[web.1]: at scala.concurrent.Future.$anonfun$flatMap$1(Future.scala:303)
    2019-07-16T12:37:43.696711+00:00 app[web.1]: at scala.concurrent.impl.Promise.$anonfun$transformWith$1(Promise.scala:37)
    2019-07-16T12:37:43.696743+00:00 app[web.1]: at scala.concurrent.impl.CallbackRunnable.run(Promise.scala:60)
    2019-07-16T12:37:43.696765+00:00 app[web.1]: at akka.dispatch.BatchingExecutor$AbstractBatch.processBatch(BatchingExecutor.scala:55)
    2019-07-16T12:37:43.696767+00:00 app[web.1]: at akka.dispatch.BatchingExecutor$BlockableBatch.$anonfun$run$1(BatchingExecutor.scala:91)
    2019-07-16T12:37:43.696768+00:00 app[web.1]: at scala.runtime.java8.JFunction0$mcV$sp.apply(JFunction0$mcV$sp.java:12)
    2019-07-16T12:37:43.696772+00:00 app[web.1]: at scala.concurrent.BlockContext$.withBlockContext(BlockContext.scala:81)
    2019-07-16T12:37:43.696776+00:00 app[web.1]: at akka.dispatch.BatchingExecutor$BlockableBatch.run(BatchingExecutor.scala:91)
    2019-07-16T12:37:43.696781+00:00 app[web.1]: at akka.dispatch.TaskInvocation.run(AbstractDispatcher.scala:40)
    2019-07-16T12:37:43.696805+00:00 app[web.1]: at akka.dispatch.ForkJoinExecutorConfigurator$AkkaForkJoinTask.exec(ForkJoinExecutorConfigurator.scala:44)
    2019-07-16T12:37:43.696809+00:00 app[web.1]: at akka.dispatch.forkjoin.ForkJoinTask.doExec(ForkJoinTask.java:260)
    2019-07-16T12:37:43.696838+00:00 app[web.1]: at akka.dispatch.forkjoin.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1339)
    2019-07-16T12:37:43.696844+00:00 app[web.1]: at akka.dispatch.forkjoin.ForkJoinPool.runWorker(ForkJoinPool.java:1979)
    2019-07-16T12:37:43.696847+00:00 app[web.1]: at akka.dispatch.forkjoin.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:107)
    j
    • 2
    • 1
  • m

    Michal Svrcek

    07/16/2019, 12:43 PM
    also
    Copy code
    Push to Prometheus Gateway failed with:
    2019-07-16T12:42:54.806370+00:00 app[web.1]: akka.stream.scaladsl.TcpIdleTimeoutException: TCP idle-timeout encountered on connection to [<http://metrics-eu1.prisma.io:443|metrics-eu1.prisma.io:443>], no bytes passed in the last 30 seconds
  • a

    Andrew O.

    07/16/2019, 6:18 PM
    There really needs to be a Nexus channel. I currently can't find any instructions on how to connect Nexus to an external GraphQL API. I have connected with the external API with GraphQL-Binding, ban I don't know what to with this part:
    t
    • 2
    • 7
  • a

    Andrew O.

    07/16/2019, 6:19 PM
    -.ts
  • f

    faure

    07/16/2019, 9:08 PM
    Help: I cannot make
    Query.dataConnection.pageInfo.hasPreviousPage
    display
    true
    when expected.
    a
    • 2
    • 36
  • e

    Erik

    07/17/2019, 7:34 AM
    hello y'all. Im having a little trouble getting started. the problem seems to be in my resolver, when I log my arguments argument in my query resolver I get this
    Error: You provided an invalid argument for the where selector on Product. { where: [Object: null prototype] { id: 'cjy2q1q0raucq0b366061xoos' } }
    . which to me look awfully wrong. the full query looks like this:
    Copy code
    query {
      product(
        where: {id: "cjy2q1q0raucq0b366061xoos"}
      ) {
        id
        name
      }
    }
    shouldn't the id argument be directly attached to the arguments object? Im logging the correct argument if I do it like this
    args.where.id
    • 1
    • 1
1...292293294...637Latest