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

    Hmm

    02/21/2019, 9:32 PM
    this gave me a link to my hosted prisma server
  • h

    Hmm

    02/21/2019, 9:33 PM
    On my frontend, I have Apollo Client. Do I replace the Apollo Client uri with this heroku address?
  • h

    Hmm

    02/21/2019, 9:34 PM
    or do I keep it as http://localhost:4000
  • j

    Jidé

    02/21/2019, 9:36 PM
    no you should use the heroku endpoint in your apollo server config and keep http://localhost:4000 on the frontend
  • h

    Hmm

    02/21/2019, 9:38 PM
    ok, that's what I thought. Even though it works either way which I don't understand. In the Wes Bos advanced react tutorial, he replaces the uri with the heroku link when deploying
  • j

    Jidé

    02/21/2019, 9:39 PM
    something like this :
    Copy code
    const db = new Prisma({
      typeDefs: "src/generated/prisma.graphql", // the auto-generated GraphQL schema of the Prisma API
      endpoint: "<https://url.to.endpoint>", // the endpoint of the Prisma API (value set in `.env`)
      debug: true // log all GraphQL queries & mutations sent to the Prisma API
      // secret: process.env.PRISMA_SECRET, // only needed if specified in `database/prisma.yml` (value set in `.env`)
    });
    
    const params = {
      typeDefs: importSchema(path.resolve("./src/schema.graphql")), // Your custom schema
      resolvers, // Your resolvers
      introspection: true, // automatic in DEV but needed in PROD too
      //playground: true, automatic in DEV
      context: req => ({
        ...req,
        db
      })
    };
    
    const server = new ApolloServer(params);
  • h

    Hmm

    02/21/2019, 9:40 PM
    yeah thats the backend
  • h

    Hmm

    02/21/2019, 9:41 PM
    my apollo client looks like
    Copy code
    function createClient(initialState) {
      return new ApolloClient({
        connectToDevTools: process.browser,
        ssrMode: !process.browser, // Disables forceFetch on the server (so queries are only run once)
        link: new HttpLink({
          uri: process.env.NODE_ENV === 'development' ? DEV_ENDPOINT : PROD_ENDPOINT,
  • h

    Hmm

    02/21/2019, 9:41 PM
    Copy code
    DEV_ENDPOINT
    is my localhost,
    Copy code
    PROD_ENDPOINT
    is the heroku link
  • h

    Hmm

    02/21/2019, 9:42 PM
    thats how Wes Bos set it up
  • j

    Jidé

    02/21/2019, 9:43 PM
    can’t tell, but the idea is that you have a prisma instance, an apollo server calling the prisma api, and the frontend is supposed to call the apollo server
  • h

    Hmm

    02/21/2019, 9:46 PM
    https://github.com/wesbos/Advanced-React/blob/master/finished-application/frontend/lib/withData.js#L8
  • k

    kshenes

    02/21/2019, 9:52 PM
    Looking for the magic sauce to getting pyton websockets to subscribe to prisma subscriptions. I have tried everything, but I cannot get the socket to return anything other than 200.
  • h

    Hmm

    02/21/2019, 9:53 PM
    have you tried javascript?
  • j

    Jidé

    02/21/2019, 10:07 PM
    @Chase There are 2 different heroku urls, one is the prisma api, the other is the apollo server deployed to heroku
  • j

    Jidé

    02/21/2019, 10:07 PM
    https://github.com/wesbos/Advanced-React/blob/master/finished-application/frontend/config.js#L3
  • j

    Jidé

    02/21/2019, 10:07 PM
    this one is apollo server running on heroku
  • j

    Jidé

    02/21/2019, 10:08 PM
    while this one is the prisma api endpoint : https://github.com/wesbos/Advanced-React/blob/master/finished-application/backend/prisma.yml#L2
  • h

    Hmm

    02/21/2019, 10:13 PM
    oh my, im going dyslexic. thank you very much for catching that
    🤣 1
  • h

    Hmm

    02/21/2019, 10:15 PM
    since my frontend and backend are on the same host, explains why localhost works in production
  • k

    Ken

    02/21/2019, 11:12 PM
    How does one access JVM logs of a prisma server? (It's running under Docker in a vm) I was able to get at the docker logs. I suspect the JVM flopped over and want to check the logs.
  • t

    theom

    02/21/2019, 11:52 PM
    So, I'm continually receiving the spinning wheel of death when attempting to view the services data-browser for my project on Eu1. Are there any known issues with the service?
    h
    • 2
    • 1
  • r

    Ricky

    02/22/2019, 6:51 AM
    hey does Prisma currently support JSONB for postgres?
    h
    • 2
    • 3
  • f

    Fran Dios

    02/22/2019, 7:10 AM
    Hi, a question about queries in Prisma: A User can have many Posts. How would we show a list of users and their total number of Posts?
    users { id posts { id } }
    and then counting
    user.posts.length
    in the frontend would work, but we cannot sort users by post amount from DB if we have pagination, right? I think requesting
    users { id postsConnections { aggregate { count } } }
    or similar is not supported by Prisma (in one single request), and if it was probably we cannot order by that in the same request. Another solution would be adding a
    totalPosts
    counter to the user and increment it every time a user writes a post, but atomic increments are not supported either so there could be issues with this as well. Therefore, what’s the recommended way to do this?
    j
    m
    • 3
    • 14
  • b

    Biel Simon

    02/22/2019, 10:03 AM
    Any ETA for the datamodel v1.1?
    🙏 3
  • j

    joan

    02/22/2019, 10:06 AM
    @Harshit @marcus I get this error when trying to delete an `event`:
    The change you are trying to make would violate the required relation 'EventToParticipant' between Event and Participant
    ...
  • j

    joan

    02/22/2019, 10:06 AM
    I've read about this here: https://github.com/prisma/prisma/issues/1262
  • j

    joan

    02/22/2019, 10:07 AM
    do I have to add
    onDelete: CASCADE
    to the schema?
    • 1
    • 1
  • b

    Biel Simon

    02/22/2019, 10:07 AM
    You have to remove the "offending" nodes or reset the instance if you are just testing
  • b

    Biel Simon

    02/22/2019, 10:08 AM
    You probably are adding a required rule to a field but there are rows with null in this field
1...221222223...637Latest