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

    pasa

    05/03/2018, 8:55 PM
    Hello everybody, I wanted to ask you for your opinion about my current setup. I'm especially interested in your opinion, if I could use this setup for a first production state, before going further. Here is my current setup. DB: AWS RDS -> Connection details like password and username are under the PRISMA_CONFIG in the docker-compose.yml. Prisma server: Runs "locally" (on the server) in a docker container. Has a secret defined in the prisma.yml file (which is also used in the
    new Prisma
    statement in the index.js of the graphql server). The playground is disabled (it should not be visible to anyone). I have a managementApiSecret in the PRISMA_CONFIG, which is also in the .env to protect the deployment process (which is probably not necessary, as the container is running locally as mentioned earlier). GraphQl server: Standard graphql server using yoga. The only thing of my api, that is actually exposed (accessible from outside), runs on the same machine, as the prisma server and accesses the service via localhost. Currently only accessible via
    hostip.port
    after being started with
    yarn start
    , but will be set up as node.js server (w/ daemon) and managed via nginx. I will also setup a ssl cert for this and direct a subdomain (like api.example.com) of my maindomain to this server and route that trough to the port of the running node.js server. What do you think? Did I forget anything? Should I pay attention to something? Whats your opinion? Thanks in advance! šŸ˜‰
    d
    • 2
    • 1
  • k

    Khoa Huynh

    05/03/2018, 11:47 PM
    hello, I want to add an array like this [{OneMonth: 0, ThreeMonth: 0, SixMonth: 0, OneYear: 0}] to a field. How can I do that
  • p

    psongpin

    05/04/2018, 3:11 AM
    Hi I'm new to Prisma and GraphQL in general, I am a React developer. I know that 1.7 is out just confused. I run
    prisma init
    in my folder, then chose the docker option with mysql. Then i run
    graphql create server
    and it created a boilerplate for me. just confused why are there two config for these?
  • d

    damon.chen

    05/04/2018, 3:11 AM
    Hey guys, Nice to meet you here.
    šŸ‘‹ 3
  • u

    user

    05/04/2018, 3:20 AM
    A file was commented on
  • j

    Jim

    05/04/2018, 6:03 AM
    Is there a smart way to control the server console logging? When im writing custom resolvers its handy to log variables to see whats going on. However my server terminal is really busy. Is there a way of temporarily disabling the default logging or easily distinguishing the console.logs that ive added? Thanks
  • u

    user

    05/04/2018, 7:28 AM
    A file was commented on
  • j

    Jim

    05/04/2018, 7:45 AM
    Ive added a content type to datamodel.graphql:
    Copy code
    type Location {
    	id: ID! @unique
    	name: String!
    	machineName: String
    }
    My query in graphiql works:
    Copy code
    query {
      locations(
        where: {
          machineName: "paris"
        }
      ) {
        id
        name
        machineName
      }
    }
    Ive added a new resolver:
    Copy code
    type Query {
      location: Location
      feed: [Post!]!
      drafts: [Post!]!
      post(id: ID!): Post
      locations: [Location!]!
      me: User
    }
    And created the resolver:
    Copy code
    location(parent, { machineName }, ctx, info) {
        return ctx.db.query.location({ where: { machineName } }, info);
      },
    But I try to call it from React I get an error:
    Network error: Response not successful: Received status code 400
    Copy code
    export const LOCATION_QUERY = gql`
      query LocationQuery {
        location(where: { machineName: "paris" }) {
          id
          name
          machineName
        }
      }
    `;
    m
    n
    • 3
    • 10
  • j

    john

    05/04/2018, 8:22 AM
    I already completed a project with UI and backend [ no DB part ] with AngularJS and Node + Apollo Graphql server. Now I created a prisma DB and got auto generated queries and mutation. So I want to connect both projects [ Apollo server project and Prisma project ]. From your link above i understood that they put actual business schema in schema.graphql and resolvers are created manually by connecting DB. So do i need to include all my resolvers and business parts of my Apollo project to the /SRC folder of Prisma project for integration. Or vice versa.
    n
    • 2
    • 2
  • p

    picosam

    05/04/2018, 9:36 AM
    Hello! Anyone has a functioning example of a Prisma project where two separate GraphQL APIs are created out of the same Prisma Server? I’m toying with this to create one ā€œpublicā€ API and another ā€œAdminā€ one. Thoughts? Thanks!
  • w

    weakky

    05/04/2018, 10:09 AM
    Hey guys, any better ideas as to how to handle product variants ? I replicated Shopify datamodel, but it’s quite a pain in the ass to generate those variants, and to convert them as option selectors 😐
    -.js
  • h

    horia.ancas

    05/04/2018, 11:11 AM
    hey guys, what’s the best way to handle authorisation with graphql directives?
    m
    • 2
    • 4
  • h

    horia.ancas

    05/04/2018, 11:11 AM
    any packages I can use?
  • j

    Jim

    05/04/2018, 11:44 AM
    Id like to let users sign up with either email, facebook or twitter. Is it advisable to write custom code for this or use a service like Auth0 or Firebase?
  • j

    Jim

    05/04/2018, 1:02 PM
    Is it possible / advisable to convert an array to a single item in a resolver? My resolver returns an array, but I know that there will always be a single result. Is it possible to modifiy the resolver to reutrn a single result? This is my resolver:
    Copy code
    location(parent, args, ctx, info) {
       const { machineName } = args;
       return ctx.db.query.locations({ where: { machineName } }, info);
     }
    This query from the front-end:
    Copy code
    {
      location(machineName: "london") {
        id
        name
        
      }
    }
    Will return:
    Copy code
    {
      "data": {
        "location": [
          {
            "id": "cjgrqosbt5eum0b51hz4yqrou",
            "name": "London"
          }
        ]
      }
    }
    But id like something like:
    Copy code
    {
      "data": {
        "location" {
          "id": "cjgrqosbt5eum0b51hz4yqrou",
          "name": "London"
        }
      }
    }
    h
    c
    +2
    • 5
    • 4
  • n

    noahdavis

    05/04/2018, 1:31 PM
    If I serially make Prisma calls, it takes forever to save the data. Forever as in days. It ran overnight and couldn't save all the data. If I allow parallel calls, I get errors. Anyone else experiencing this?
    h
    n
    m
    • 4
    • 29
  • j

    Jim

    05/04/2018, 1:46 PM
    Id like to try Prisma Cloud. How do I go about choosing between RDS vs AWS Aurora databases?
  • s

    shane

    05/04/2018, 2:36 PM
    Does anyone know how to properly set the fetchPolicy on the newer Apollo Query Component? The docs don’t give an example… ie:
    Copy code
    <Query query={MY_QUERY} fetchPolicy={'network-only'}>
    or
    Copy code
    <Query query={MY_QUERY} fetchPolicy="network-only">
    n
    • 2
    • 2
  • m

    medelman

    05/04/2018, 2:36 PM
    Has anyone else been having issues with the
    exists
    operation after upgrading to Prisma 1.7? Was the syntax somehow changed? The following code, which used to work fine, now throws a TypeError: "cannot read property 'call' of undefined":
    const exists = await ctx.db.exists.Media({ localSource })
    n
    • 2
    • 3
  • p

    pettanko

    05/04/2018, 3:28 PM
    Anyone that can tell me how to use cors properly? šŸ˜• My windows computer can't send graphql requests to my mac, but I can visit the graphql endpoint and use playground.
    l
    • 2
    • 5
  • t

    theom

    05/04/2018, 4:12 PM
    So, I just tried to upgrade a legacy project to the new framework and gvot the following message:
    Copy code
    The project could not be ejected because it has enabled integrations. Please migrate all integrations to resolvers first.
    How do I 'migrate all integrations to resolvers'?
    šŸ™ 1
  • l

    lawjolla

    05/04/2018, 5:26 PM
    Excited for your Next.js book!
    🦜 2
  • r

    rafaelcorreiapoli

    05/04/2018, 10:48 PM
    Hi. Are there differences between the instances on Prisma Cloud and the ones deployed locally? I’m experiencing differences between an instance on prisma cloud and one deployed locally (tested with versions 1.7 and 1.8)
  • r

    rafaelcorreiapoli

    05/04/2018, 10:52 PM
    -.txt
  • r

    rafaelcorreiapoli

    05/04/2018, 10:53 PM
    I get the error above when trying to create something with connected entities, like this:
    Copy code
    mutation {
      createAttachment(data:{
        name: "teste",
        description:"desc",
        type: ARTICLE,
        kind:WEB,
        imageUrl:"<http://www.google.com>",
        url:"<http://www.google.com>"
        organizations:{
          connect: [{
            id: "cjgsibg858lms0b06p4a6lgj4"
          }]
        }
      }) {
        id
        name
      }
    }
    n
    • 2
    • 1
  • r

    rafaelcorreiapoli

    05/04/2018, 10:53 PM
    When testing this same query against a cluster deployed on prisma cloud, it works
  • r

    rafaelcorreiapoli

    05/04/2018, 10:58 PM
    Ok, turns out that I was using postgres on the local cluster, so this is a problem with the postgres connector I guess
  • r

    rafaelcorreiapoli

    05/04/2018, 10:58 PM
    using the mysql connector on the local cluster it worked
  • k

    Khoa Huynh

    05/05/2018, 12:06 AM
    hello, I want to add an array like this [{OneMonth: 0, ThreeMonth: 0, SixMonth: 0, OneYear: 0}] to a field. How can I do that
    z
    • 2
    • 1
  • j

    Jim

    05/05/2018, 3:13 AM
    I need to alter my layout dependin on weather a user is logged in or not. Is this a good pattern?
    Copy code
    const ME = gql`
      query me {
        me {
          id
        }
      }
    `;
    
     <Query query={ME}>
              {({ loading, error, data }) => {
                if (loading) return <Loading />;
                const userisLoggedIn = error ? false : true;
    
                // Then I use userisLoggedIn to conditionally render stuff
    It seems to work but Graphcool BaaS retunred null rather than an error when you queried for a logged in user. For some reason that felt more proper to me.
    n
    • 2
    • 1
1...202122...637Latest