The tutorial says you only need to add `<http://lo...
# prisma-whats-new
d
The tutorial says you only need to add
http://localhost:3000
to the list of CB urls, but sometimes I get this error, which I tried adding, and didn’t help
n
@doug_w hey sorry to hear!
could you try removing the
this.props.router.replace('/')
lines and put a debugger statement there instead?
d
lol thanks for your pitty! I shall try that
n
or
console.log
the response
d
It doesn’t appear to even call the ‘createUser’ function inside of the
CreateUser
component
It’s like it’s skipping the component all together
I know I sound crazy, but literally the only thing I changed since cloning the repo, was adding my KEYS
Copy code
createUser = () => {
    const variables = {
      idToken: window.localStorage.getItem('auth0IdToken'),
      emailAddress: this.state.emailAddress,
      name: this.state.name,
      emailSubscription: this.state.emailSubscription,
    }

    this.props.createUser({ variables })
      .then((response) => {
        console.log('SUCCESS RESPONSE', response)
      }).catch((e) => {
        console.log('ERROR RESPONSE', e)

      })
  }
Don’t get anything in the console
Not trying to be annoying - just trying to provide information. If I try to signup new user with Google - that is when I get the error
http://localhost:3000/signup is not in the list of allowed callback URLs
n
did you try adding it to the allowed callback urls? 🙂
d
Yes I did. It just get’s me past that specific error. Then still just reroutes me back to the unlogged in view - and no user created in graph.cool db etc
n
can you run the
createUser
mutation yourself in the playground and see what it returns?
you need to copy a valid auth0token for that
d
Ok let me give that a shot - is the authToken what is generated by this?
this._lock = new Auth0Lock(props.clientId, props.domain)
n
no
it's in the response to the
authenticated
event of the lock
d
Ok got it thx
So here is my mutation:
Copy code
mutation b {
  createUser(
    name: "Doug W", 
    emailAddress: "d@d.com", 
    auth0token: "token..etc",
    emailSubscription: false) {
    id
  }
}
Which gets
"Unknown argument 'auth0token' on field 'createUser' of type 'Mutation'. Did you mean 'authProvider
Then I try
authProvider
as the key and I get
"Argument 'authProvider' expected type 'AuthProviderSignupData!'
this is how the
createUser
mutation has to look like 🙂
authProvider
is an object input argument
Copy code
mutation b {
  createUser(
    name: "Doug W", 
    emailAddress: "d@d.com", 
    authProvider: { auth0: { idToken: "token..etc"} }
    emailSubscription: false) {
    id
  }
}
d
Ok got it thanks. So that successfully created a User
n
ah, that's cool
so your app obtains a valid token from Auth0, but there is a bug happening before it reaches the
createUser
mutation
d
Agreed
n
hmm can you try to debug-step your way through and find out when it goes wrong?
d
Oyaya this is nuts. I appreciate your help! I am also getting an error that is breaking the page on load. I haven’t introduced any changes
It’s a react error saying in invalid component is being returned by NewPostLink
You likely forgot to export your component from the file it's defined in. Check your code at NewPostLink.js:8.
n
the repo had some movement recently and it might be a version problem too 🙂
d
It’s odd because I haven’t touched that file, and this error is brand new
n
d
Yup
n
ouch
d
?
n
could you try to put
import {  Link } from 'react-router-dom'
in the
NewPostLink
file instead?
d
Lol wowwww
n
😕
d
That did it. I did notice router was upgraded so I suppose I could of caught that. Just new to this graph.cool thing so I wasn’t sure where the error was coming from 😂
n
Is it working now?
aw damn it
I missed that
could you please make a PR? 🙂 that would be awesome
d
Yeah I am on it!
❤️ 1
Thanks for your help though - we love the product and will be switching a massive DB to this in the next couple of weeks - good to know you are supportive! Whats your twitter handle?
n
Hah, I should thank you! That was awesome team work 😉
d
👏
n
d
awesome… cheers
n
Thanks Doug
d
It’s me again 😬 Maybe you can pull that repo and check it out at some point. It is still wonky. In fact it’s blowing my mind. It was actually working for a bit - and now I can’t get it to work at all. Even starting from fresh cloning the master branch and simply adding my API keys. I did notice that in
CreatePost
and
CreateUser
still have
import { withRouter } from 'react-router'
Which I tried changing them to
import { withRouter } from 'react-router-dom'
and it didn’t seem to help. Even when it did appear to be working by routing me to the logged in view - I never did get a new User data created in my Graph.cool DB. Is there any need for
react-router
at all? I tried deleting it as a dependency and removing it everywhere but that didn’t seem to fix either.
It still just never gets to that createUser function
Copy code
createUser = () => {
    alert('about to create user')
    const variables = {
      idToken: window.localStorage.getItem('auth0IdToken'),
      emailAddress: this.state.emailAddress,
      name: this.state.name,
      emailSubscription: this.state.emailSubscription,
    }
n
@doug_w alright let's see, does it work in an incognito tab? Does it work in an incognito tab after deleting all users in your Graphcool project?
I can see two possible problems - 1) localStorage is not handled correctly 2) when user already exists, we're not correctly signing in
let's try to rule them out