https://www.prisma.io/ logo
Join Slack
Powered by
# prisma-whats-new
  • j

    jakkiraju

    06/24/2017, 4:41 PM
    I'm trying to run authentication-with-auth0-and-lokka with yarn/npm and I get this..
    UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 2): TypeError: "listener" argument must be a function
    n
    • 2
    • 35
  • j

    jakkiraju

    06/24/2017, 4:41 PM
    Can anyone help please!
  • s

    sebd

    06/24/2017, 4:43 PM
    Hi there, I'm having trouble with subscription on objects containing fields that are relations... I'm getting a notif fine if I change a text field for example, but not if I change a relation to another object (many to many relations). Is that normal?
    a
    n
    • 3
    • 4
  • f

    florian

    06/24/2017, 4:45 PM
    Hello, pretty new to GraphCool but I was able to prototype things very quickly ! However I'm hitting a wall with a filtered query. I have a Document collection that contains tags. I want to filter the document list with those tags. I have a query (below) that works but I have no idea how to handle a state where no filter are selected
  • f

    florian

    06/24/2017, 4:45 PM
    Copy code
    query DocumentQuery($locale: String!, $tags: [String!]) {
        _allDocumentsMeta(
          filter:{
            locale: $locale,
            published: true,
            tags_some: {
              content_in: $tags
            }
          }
        ){
          count
        }
        allDocuments(
          filter:{
            locale: $locale,
            published: true,
            tags_some: {
              content_in: $tags
            }
          }
        ) {
          id,
          file {
            name,
            url
          },
          title,
          description,
          tags {
            id,
            content
          }
        }
      }
    a
    n
    • 3
    • 18
  • f

    florian

    06/24/2017, 4:46 PM
    How do i get the full list of documents (unfiltered) when
    $tags===[]
    ?
  • m

    mc_lovin

    06/24/2017, 6:39 PM
    Hey guys, question about function signature . Why does resolve in this sort of definition take
    _
    as the first arg
    Copy code
    var queryType = new graphql.GraphQLObjectType({
      name: 'Query',
      fields: {
        user: {
          type: userType,
          // `args` describes the arguments that the `user` query accepts
          args: {
            id: { type: graphql.GraphQLString }
          },
          resolve: function (_, {id}) {
            return fakeDatabase[id];
          }
        }
      }
    });
    while in static implementation it is something like
    Copy code
    var root = {
      ip: function (args, request) {
        return request.ip;
      }
    };
  • m

    mc_lovin

    06/24/2017, 6:40 PM
    I mean why the function definition is different in both cases
  • a

    agartha

    06/24/2017, 6:43 PM
    Are SSS run with the authentication of the same user that triggered it?
    n
    • 2
    • 22
  • j

    josiah

    06/24/2017, 6:44 PM
    Hi everyone, new here and trying to understand some basics. One concern is about version control and code backup / export. Is there any way to access the code we author outside of the console?
    n
    • 2
    • 13
  • j

    josiah

    06/24/2017, 6:47 PM
    this being for functions and permission queries and anywhere else that we might author code
  • j

    josiah

    06/24/2017, 6:52 PM
    it looks like this is all powered by Auth0 Extend? according to their website there is bi-directional GitHub integration available. Is that exposed in any way by graphcool?
    n
    • 2
    • 2
  • g

    geekodour

    06/24/2017, 7:54 PM
    Hello
  • g

    geekodour

    06/24/2017, 7:55 PM
    Copy code
    Error: GraphQL error: Unknown argument 'authProvider' on field 'createUser' of type 'Mutation'. (line 2, column 14):
      createUser(authProvider: {auth0: {idToken: $idToken}}) {
                 ^
    Stack trace:
    ApolloError@http://localhost:3000/static/js/bundle.js:11384:21
    QueryManager.prototype.mutate/</<@http://localhost:3000/static/js/bundle.js:29138:33
  • g

    geekodour

    06/24/2017, 7:55 PM
    authProvider field should work should not it?
  • g

    geekodour

    06/24/2017, 7:58 PM
    I am using Auth0
  • g

    geekodour

    06/24/2017, 7:58 PM
    the User type has no additional fields, the mutation looks like
  • g

    geekodour

    06/24/2017, 7:59 PM
    Copy code
    export const CREATE_USER = gql`mutation ($idToken: String!){
        createUser(authProvider: {auth0: {idToken: $idToken}}) {
          id
        }
    }`
  • g

    geekodour

    06/24/2017, 7:59 PM
    any help?
  • a

    agartha

    06/24/2017, 8:03 PM
    Did you activate Auth0 integration?
  • g

    geekodour

    06/24/2017, 8:10 PM
    yes
  • g

    geekodour

    06/24/2017, 8:12 PM
    Here's the component
  • g

    geekodour

    06/24/2017, 8:12 PM
    Copy code
    import React from 'react'
    import Auth0Lock from 'auth0-lock'
    import { graphql } from 'react-apollo'
    import { CREATE_USER } from '../mutations'
    import { USER_QUERY } from '../queries'
    
    const LoginAuth0 = props => {
      const _lock = new Auth0Lock('lnmp9wV665254625hfX4', '<http://geeko222.auth0.com|geeko222.auth0.com>');
    
      _lock.on('authenticated', (authResult) => {
        window.localStorage.setItem('auth0IdToken', authResult.idToken);
        console.log('gotcha!');
        createUser();
      })  
    
      const createUser = () => {
        const variables = { 
          idToken: window.localStorage.getItem('auth0IdToken')
        }   
        props.createUser({ variables })
          .then((response) => {
              console.log('DONE');
          }).catch((e) => {
            console.error(e)
          })  
      }
    
      return (
         <button onClick={()=>(_lock.show())}>Login</button>
      )
    }
    
    
    const LoginCREATE_USER = graphql(CREATE_USER,{
            props: ({ ownProps, mutate }) => ({
              createUser: ({ idToken }) =>
                mutate({
                  variables: { idToken },
                })  
            }), 
            name: 'createUser'})(LoginAuth0)
    
    export default graphql(USER_QUERY,{ options: { fetchPolicy: 'network-only' } })(LoginCREATE_USER)
  • j

    jakkiraju

    06/24/2017, 8:12 PM
    I get this error when I try to createUser
    Copy code
    Error: GraphQL Error: The provided idToken is invalid. Please see <https://auth0.com/docs/tokens/id_token> for how to obtain a valid idToken
        at Transport.handleErrors (index.js:70)
        at index.js:142
        at <anonymous>
    d
    n
    • 3
    • 5
  • j

    jakkiraju

    06/24/2017, 8:14 PM
    here is my code
  • j

    jakkiraju

    06/24/2017, 8:14 PM
    Copy code
    _maybeCreateUser = async () => {
        const headers = {
          'Authorization': `Bearer ${this.state.auth0IdToken}`
        }
    
        const transport = new Transport(graphcoolEndpoint, {headers})
        const api = new Lokka({ transport })
    
        // check if a user is already logged in 
        const userResult = await api.query(`{
          user {
            id
          }
        }`)
    
        if (!userResult.user) {
          console.log("user does not exist");
          console.log(this.state.auth0IdToken);
          // need to create user
          try {
            await api.mutate(`{
              createUser(authProvider: {
                auth0: {
                  idToken: "${this.state.auth0IdToken}"
                }
              }) {
                id
              }
            }`)
          } catch (e) {
            console.log(e);
            console.log('could not create user')
            // logout to clear a potential existing auth0 token that is invalid
            this._logout()
          }
        }
      }
  • b

    bcbrian

    06/24/2017, 8:21 PM
    @jakkiraju I have this problem in the past and am experiencing it right now as well 😛 I vaguely remember it being related to the what I was requesting the info from auth0
    this._lock = new Auth0Lock(props.clientId, props.domain)
  • j

    jakkiraju

    06/24/2017, 8:23 PM
    @bcbrian I double checked it
  • j

    jakkiraju

    06/24/2017, 8:23 PM
    I'm passing the right cliendId and domain name
  • c

    chicagoboy2011

    06/24/2017, 8:48 PM
    I have a conceptual question I needed some help with: Suppose I have a "Game" type and one of its Fields is questions, which will contain a reference to all the questions that were used in that game. Now, these questions will be used in many, many games, and while I need to know which questions belong to a game, I'll never need to query a question to find out what games it has been in. As I'm currently seeing the graphcool console, there's no way for me to set a relation which is only tracked in one object; With this example, the moment that I say that the field "questions" will contain an array referencing several different Questions type, Graphcool automatically makes a new field "games" in question, which I don't need at all. Is there a way to prevent that?
    a
    • 2
    • 7
1...244245246...637Latest