__typename在查询中时,联合身份验证失败

问题描述

演示存储库:https://github.com/TheAschr/federation-bug-demo

我有一个工会联合会失败的特殊情况。这是我的查询

{
  accounts {
    id
    user {
      ... on StandardUser {
        id
        film {
          id
          __typename
        }
      }
      ... on AdminUser {
        id
        film {
          id
          review {
            id
          }
        }
      }
    }
  }
}

这是我得到的答复:

{
  "errors": [
    {
      "message": "Field \"reviewId\" was not found in response.","extensions": {
        "code": "INTERNAL_SERVER_ERROR","exception": {
          "stacktrace": [
            "Error: Field \"reviewId\" was not found in response.","    at executeSelectionSet (C:\\Users\\me\\Documents\\github\\federation-demo\\node_modules\\@apollo\\gateway\\dist\\executeQueryPlan.js:217:27)","    at executeSelectionSet (C:\\Users\\me\\Documents\\github\\federation-demo\\node_modules\\@apollo\\gateway\\dist\\executeQueryPlan.js:236:51)","    at C:\\Users\\me\\Documents\\github\\federation-demo\\node_modules\\@apollo\\gateway\\dist\\executeQueryPlan.js:121:36","    at Array.forEach (<anonymous>)","    at executeFetch (C:\\Users\\me\\Documents\\github\\federation-demo\\node_modules\\@apollo\\gateway\\dist\\executeQueryPlan.js:120:18)","    at executeNode (C:\\Users\\me\\Documents\\github\\federation-demo\\node_modules\\@apollo\\gateway\\dist\\executeQueryPlan.js:82:23)","    at executeNode (C:\\Users\\me\\Documents\\github\\federation-demo\\node_modules\\@apollo\\gateway\\dist\\executeQueryPlan.js:73:33)","    at executeNode (C:\\Users\\me\\Documents\\github\\federation-demo\\node_modules\\@apollo\\gateway\\dist\\executeQueryPlan.js:56:46)","    at processticksAndRejections (internal/process/task_queues.js:97:5)","    at async Object.executeQueryPlan (C:\\Users\\me\\Documents\\github\\federation-demo\\node_modules\\@apollo\\gateway\\dist\\executeQueryPlan.js:22:27)","    at async Object.ApolloGateway.executor (C:\\Users\\me\\Documents\\github\\federation-demo\\node_modules\\@apollo\\gateway\\dist\\index.js:109:30)"
          ]
        }
      }
    }
  ],"data": {
    "accounts": [
      {
        "id": "1","user": {
          "id": "1","film": {
            "id": "1","review": null
          }
        }
      },{
        "id": "2","user": {
          "id": "2","__typename": "Film"
          }
        }
      }
    ]
  }
}

当我删除__typename时,查询完成:

{
  accounts {
    id
    user {
      ... on StandardUser {
        id
        film {
          id
        }
      }
      ... on AdminUser {
        id
        film {
          id
          review {
            id
          }
        }
      }
    }
  }
}

忽略此文本。 Stackoverflow希望我输入更多内容... asdf asdf asdfasdfa sfasdfasdf

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)