full code: ``` const pric...
# prisma-whats-new
r
full code:
Copy code
const prices = {
                            usd: fetchedGame.usd,
                            cad: fetchedGame.cad,
                            mxn: fetchedGame.mxn    
                        };
                        
                        return api.request(`
                            mutation($prices: Json!) {
                                updateNAGame(
                                    id: "${dbGame.id}"
                                    title: "${fetchedGame.title}"
                                    imageUrl: "${fetchedGame.imageUrl}"
                                    releaseDate: "${fetchedGame.releaseDate}"
                                    usd: "${fetchedGame.usd}"
                                    cad: "${fetchedGame.cad}"
                                    mxn: "${fetchedGame.mxn}"
                                    eshopLink: "${fetchedGame.eshopLink}"
                                    prices: $prices
                                ){
                                    id
                                }
                            }
                        `, 
                        { prices: prices }
                        )
w
What does the SDL for updateNAGame look like?
r
what do you mean?
Copy code
type NAGame @model {
  id: ID! @isUnique
  createdAt: DateTime!
  updatedAt: DateTime!

  title: String!
  eshopLink: String
  nsuid: String! @isUnique
  imageUrl: String!
  releaseDate: DateTime!

  usd: String!
  cad: String!
  mxn: String!

  prices: Json

  discount: NADiscount @relation(name: "NAGameDiscount")
  wishLists: [NAWishListItem!]! @relation(name: "WishListNAGame")
}
w
When I first saw your error, I wondered if your json was escaped too many times. But I see you tried both a raw object, and a stringified one. Does the error change depending on which way you try?
r
it keep saying it is not valid json
w
What about the string it shows?
the one w/ all of the `\\\`'s
r
let me try again
w
also curious, is api.request your code, or something imported/provided?
r
its from the graphcool lib package
w
ahh
r
this is the string when I do not use stringify
'\"{\\\"usd\\\":\\\"7.99\\\",\\\"cad\\\":\\\"9.87\\\",\\\"mxn\\\":\\\"150.99\\\"}\"'
w
it definitely looks like there are extra `\\`'s
r
now let me try with stringify
'\"{\\\"usd\\\":\\\"11.99\\\",\\\"cad\\\":\\\"13.99\\\",\\\"mxn\\\":\\\"200\\\"}\"'
looks like its the same thing?
w
yah, looks the same
I feel like this is the raw thing that is being passed:
Copy code
"{\"usd\":\"7.99\",\"cad\":\"9.87\",\"mxn\":\"150.99\"}"
r
oh wait
sorry
I think those were both with stringify
just a sec
'\"{\\\"usd\\\":\\\"7.99\\\",\\\"cad\\\":\\\"9.87\\\",\\\"mxn\\\":\\\"150.99\\\"}\"'
still looks the same
w
yah
r
could this be a problem with the graphcool lib package?
w
is this happening in the browser, or from a server?
the api.request call
r
@nilan do you have an idea what Im doing wrong?
from a server
w
ahh
r
a lambda function
I found the bug
w
was it in the library?
r
yup
w
nice find!
r
the error I saw was actually the json that was aleady stored in the db
a node cannot be updated when invalid json is already there
well
that invalid json really messed up my whole table