react-apollo icon indicating copy to clipboard operation
react-apollo copied to clipboard

Error: Argument id for data.postedBy.connect.id must not be null. Please use undefined instead.

Open willwang888 opened this issue 5 years ago • 2 comments

Hi,

I posted about this in the the howtographql repo, but it looks like that repo is pretty unmaintained. My issue also has to do specifically with this repo as well:

https://github.com/howtographql/howtographql/issues/1217#issue-758185732

Would greatly appreciate any help here. Thank you!

willwang888 avatar Dec 07 '20 06:12 willwang888

I checked about this in the the howtographql repo.

https://github.com/howtographql/howtographql/issues/1227#issue-767406812

How to fix the issue?

gokulyc avatar Dec 18 '20 05:12 gokulyc

A workaround to this problem is by making signup and login mutations to the server before you make any other mutations so the getUserId function from the utils file would not return null value.

You should query token in the login mutation and use the returned token in the Authorization field of HTTP HEADERS.

Make sure to always set Authorization field with the token you obtained from the login query so you are authorized to make the post mutation. image image

Hope this help.

HangCcZ avatar Dec 24 '20 21:12 HangCcZ