Warning; long post ahead, lots of data.
Short version: Update mutation has unexpected behaviour. Some mutations only produce the expected result after 2 tries (without failing on the first one) and Reference object produces wrong link.
Detailed story:
I have Channel objects that have a list of Traffic objects. Before the updates, a query result for channels look like that:
{
"data": {
"queryChannel": [
{
"name": "Referral",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": []
},
{
"name": "Social",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": []
},
{
"name": "Direct",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": []
},
{
"name": "Organic Search",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": []
}
]
},
I have a mutation that looks like this:
mutation MyMutation ($filter: UpdateChannelInput!){
updateChannel(input: $filter) {
numUids
}
}
So I try the first input:
{
"filter" : {"filter":{"name":{"eq":"Referral","le":null,"lt":null,"ge":null,"gt":null},"ownerId":null,"and":null,"or":null,"not":null},"set":{"name":null,"campaigns":null,"sendsTrafficTo":[{"fromChannel":{"name":"Referral","campaigns":null,"sendsTrafficTo":null,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},"fromCampaign":{"name":null,"gaId":"(not set)","ads":null,"sendsTrafficTo":null,"ownerId":null},"fromAd":null,"fromURL":null,"toURL":{"url":"/","redirectsTo":null,"delivers":{"canonicalURL":"/","htmlTitle":null,"customerFacingName":null,"linksTo":null,"conversionElements":null,"intendsToFunnelTo":null,"sendsTrafficTo":null,"ownerId":null},"sendsTrafficTo":null,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},"sessions7DayRollAvg":1,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},{"fromChannel":{"name":"Referral","campaigns":null,"sendsTrafficTo":null,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},"fromCampaign":{"name":null,"gaId":"(not set)","ads":null,"sendsTrafficTo":null,"ownerId":null},"fromAd":null,"fromURL":null,"toURL":{"url":"/","redirectsTo":null,"delivers":{"canonicalURL":"/","htmlTitle":null,"customerFacingName":null,"linksTo":null,"conversionElements":null,"intendsToFunnelTo":null,"sendsTrafficTo":null,"ownerId":null},"sendsTrafficTo":null,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},"sessions7DayRollAvg":4,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"}],"ownerId":null},"remove":null}
}
(Code generated by github.com/Yamashou/gqlgenc)
After I run it, despite getting a success message, I get still the same result when I query my Channels:
{
"data": {
"queryChannel": [
{
"name": "Referral",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": []
},
{
"name": "Social",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": []
},
{
"name": "Direct",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": []
},
{
"name": "Organic Search",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": []
}
]
},
But if I run the SAME update mutation, with the SAME filter object as variable, I get the SAME success result, but this time, my channels query returns:
{
"data": {
"queryChannel": [
{
"name": "Referral",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": [
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Referral"
},
"sessions7DayRollAvg": 1
},
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Referral"
},
"sessions7DayRollAvg": 4
}
]
},
{
"name": "Social",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": []
},
{
"name": "Direct",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": []
},
{
"name": "Organic Search",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": []
}
]
},
Then, I try my second input (for Social channel update)
{"filter":{"name":{"eq":"Social","le":null,"lt":null,"ge":null,"gt":null},"ownerId":null,"and":null,"or":null,"not":null},"set":{"name":null,"campaigns":null,"sendsTrafficTo":[{"fromChannel":{"name":"Social","campaigns":null,"sendsTrafficTo":null,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},"fromCampaign":{"name":null,"gaId":"(not set)","ads":null,"sendsTrafficTo":null,"ownerId":null},"fromAd":null,"fromURL":null,"toURL":{"url":"/?fbclid=IwAR0CMotZUEWWR_RWdhitWWofljeZRhmPBMu_a9ud6IlO9p-9jZEoStiaZaA","redirectsTo":null,"delivers":{"canonicalURL":"/?fbclid=IwAR0CMotZUEWWR_RWdhitWWofljeZRhmPBMu_a9ud6IlO9p-9jZEoStiaZaA","htmlTitle":null,"customerFacingName":null,"linksTo":null,"conversionElements":null,"intendsToFunnelTo":null,"sendsTrafficTo":null,"ownerId":null},"sendsTrafficTo":null,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},"sessions7DayRollAvg":1,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},{"fromChannel":{"name":"Social","campaigns":null,"sendsTrafficTo":null,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},"fromCampaign":{"name":null,"gaId":"(not set)","ads":null,"sendsTrafficTo":null,"ownerId":null},"fromAd":null,"fromURL":null,"toURL":{"url":"/?fbclid=IwAR1nw1jwDyTW-L2YF-veTUaXswtauPMe6yrZngyygAaOmMfjmlF8Zt0JtQA","redirectsTo":null,"delivers":{"canonicalURL":"/?fbclid=IwAR1nw1jwDyTW-L2YF-veTUaXswtauPMe6yrZngyygAaOmMfjmlF8Zt0JtQA","htmlTitle":null,"customerFacingName":null,"linksTo":null,"conversionElements":null,"intendsToFunnelTo":null,"sendsTrafficTo":null,"ownerId":null},"sendsTrafficTo":null,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},"sessions7DayRollAvg":1,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},{"fromChannel":{"name":"Social","campaigns":null,"sendsTrafficTo":null,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},"fromCampaign":{"name":null,"gaId":"(not set)","ads":null,"sendsTrafficTo":null,"ownerId":null},"fromAd":null,"fromURL":null,"toURL":{"url":"/?fbclid=IwAR3PzSmn5eVMQ80WxU-dRgiKp5Wi6DpNBtB_C_cD1Ds8ccAnkI03Gwvaow8","redirectsTo":null,"delivers":{"canonicalURL":"/?fbclid=IwAR3PzSmn5eVMQ80WxU-dRgiKp5Wi6DpNBtB_C_cD1Ds8ccAnkI03Gwvaow8","htmlTitle":null,"customerFacingName":null,"linksTo":null,"conversionElements":null,"intendsToFunnelTo":null,"sendsTrafficTo":null,"ownerId":null},"sendsTrafficTo":null,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},"sessions7DayRollAvg":1,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"}],"ownerId":null},"remove":null}
Which this time takes 3 attempts to get to the expected result (first two times, I get success but no changes are visible after my query to channels):
{
"data": {
"queryChannel": [
{
"name": "Referral",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": [
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Referral"
},
"sessions7DayRollAvg": 1
},
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Referral"
},
"sessions7DayRollAvg": 4
}
]
},
{
"name": "Social",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": [
{
"toURL": {
"url": "/?fbclid=IwAR3PzSmn5eVMQ80WxU-dRgiKp5Wi6DpNBtB_C_cD1Ds8ccAnkI03Gwvaow8"
},
"fromChannel": {
"name": "Social"
},
"sessions7DayRollAvg": 1
},
{
"toURL": {
"url": "/?fbclid=IwAR0CMotZUEWWR_RWdhitWWofljeZRhmPBMu_a9ud6IlO9p-9jZEoStiaZaA"
},
"fromChannel": {
"name": "Social"
},
"sessions7DayRollAvg": 1
},
{
"toURL": {
"url": "/?fbclid=IwAR1nw1jwDyTW-L2YF-veTUaXswtauPMe6yrZngyygAaOmMfjmlF8Zt0JtQA"
},
"fromChannel": {
"name": "Social"
},
"sessions7DayRollAvg": 1
}
]
},
{
"name": "Direct",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": []
},
{
"name": "Organic Search",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": []
}
]
},
After that, I tried my third input:
{"filter":{"name":{"eq":"Direct","le":null,"lt":null,"ge":null,"gt":null},"ownerId":null,"and":null,"or":null,"not":null},"set":{"name":null,"campaigns":null,"sendsTrafficTo":[{"fromChannel":{"name":"Direct","campaigns":null,"sendsTrafficTo":null,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},"fromCampaign":{"name":null,"gaId":"(not set)","ads":null,"sendsTrafficTo":null,"ownerId":null},"fromAd":null,"fromURL":null,"toURL":{"url":"/","redirectsTo":null,"delivers":{"canonicalURL":"/","htmlTitle":null,"customerFacingName":null,"linksTo":null,"conversionElements":null,"intendsToFunnelTo":null,"sendsTrafficTo":null,"ownerId":null},"sendsTrafficTo":null,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},"sessions7DayRollAvg":22,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},{"fromChannel":{"name":"Direct","campaigns":null,"sendsTrafficTo":null,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},"fromCampaign":{"name":null,"gaId":"(not set)","ads":null,"sendsTrafficTo":null,"ownerId":null},"fromAd":null,"fromURL":null,"toURL":{"url":"/","redirectsTo":null,"delivers":{"canonicalURL":"/","htmlTitle":null,"customerFacingName":null,"linksTo":null,"conversionElements":null,"intendsToFunnelTo":null,"sendsTrafficTo":null,"ownerId":null},"sendsTrafficTo":null,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},"sessions7DayRollAvg":4,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},{"fromChannel":{"name":"Direct","campaigns":null,"sendsTrafficTo":null,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},"fromCampaign":{"name":null,"gaId":"(not set)","ads":null,"sendsTrafficTo":null,"ownerId":null},"fromAd":null,"fromURL":null,"toURL":{"url":"/","redirectsTo":null,"delivers":{"canonicalURL":"/","htmlTitle":null,"customerFacingName":null,"linksTo":null,"conversionElements":null,"intendsToFunnelTo":null,"sendsTrafficTo":null,"ownerId":null},"sendsTrafficTo":null,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"},"sessions7DayRollAvg":3,"ownerId":"6Qv-HAhSc4HrGC5XzpB3p"}],"ownerId":null},"remove":null}
Which gives me this result:
{
"data": {
"queryChannel": [
{
"name": "Referral",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": [
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Referral"
},
"sessions7DayRollAvg": 1
},
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Referral"
},
"sessions7DayRollAvg": 4
},
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Organic Search"
},
"sessions7DayRollAvg": 22
},
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Organic Search"
},
"sessions7DayRollAvg": 4
},
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Organic Search"
},
"sessions7DayRollAvg": 3
}
]
},
{
"name": "Social",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": [
{
"toURL": {
"url": "/?fbclid=IwAR3PzSmn5eVMQ80WxU-dRgiKp5Wi6DpNBtB_C_cD1Ds8ccAnkI03Gwvaow8"
},
"fromChannel": {
"name": "Social"
},
"sessions7DayRollAvg": 1
},
{
"toURL": {
"url": "/?fbclid=IwAR0CMotZUEWWR_RWdhitWWofljeZRhmPBMu_a9ud6IlO9p-9jZEoStiaZaA"
},
"fromChannel": {
"name": "Social"
},
"sessions7DayRollAvg": 1
},
{
"toURL": {
"url": "/?fbclid=IwAR1nw1jwDyTW-L2YF-veTUaXswtauPMe6yrZngyygAaOmMfjmlF8Zt0JtQA"
},
"fromChannel": {
"name": "Social"
},
"sessions7DayRollAvg": 1
},
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Organic Search"
},
"sessions7DayRollAvg": 22
},
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Organic Search"
},
"sessions7DayRollAvg": 4
},
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Organic Search"
},
"sessions7DayRollAvg": 3
}
]
},
{
"name": "Direct",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": [
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Organic Search"
},
"sessions7DayRollAvg": 22
},
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Organic Search"
},
"sessions7DayRollAvg": 4
},
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Organic Search"
},
"sessions7DayRollAvg": 3
}
]
},
{
"name": "Organic Search",
"ownerId": "6Qv-HAhSc4HrGC5XzpB3p",
"sendsTrafficTo": [
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Organic Search"
},
"sessions7DayRollAvg": 22
},
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Organic Search"
},
"sessions7DayRollAvg": 4
},
{
"toURL": {
"url": "/"
},
"fromChannel": {
"name": "Organic Search"
},
"sessions7DayRollAvg": 3
}
]
}
]
}
At which point I just stopped trying to figure out what was going on. You can see that now I have traffic objects that were not even added yet (fromChannel Organic Search), repeated in Channels that not should be even found by the filter etc.
I do not discard possibilities of having problems with the self generated code, but this queries with their input variables are producing these results even when using the API Explorer on Slash’s dash.
Can you help me figure out what is happening?
Thanks!