jai
jai3y ago

SyntaxError Unexpected token u in JSON at position 0 with mutations

I'm trying to use trpc client to await a mutation and just keep getting this error. everything works if i change the mutations into queries
6 Replies
Unknown User
Unknown User3y ago
Message Not Public
Sign In & Join Server To View
jai
jaiOP3y ago
i'll send more info tomorrow
jai
jaiOP3y ago
@oscartbeaumont i went back to working on this and here is more information. this user.auth works as a query, but when switched to a mutation it breaks with these errors. i am using the client api
jai
jaiOP3y ago
it seems like the "u" in the json error is referring to undefined somewhere, but the payload is sending correctly
jai
jaiOP3y ago
the links and transformer
jai
jaiOP3y ago
i had a middleware that was assuming requests were queries and parsing the input json. that caused issues when using mutations

Did you find this page helpful?