热门标签 | HotTags
当前位置:  开发笔记 > 编程语言 > 正文

Autoinjected__typenameisbeingpassedtotheSQLbackend

HiIhavejustimplementedApolloClient2.0withVueApollo.Imhavingsomepro

Hi

I have just implemented Apollo Client 2.0 with VueApollo. I'm having some problems though, and I was hoping you might have some insights or pointers where to look.

A simple apollo: query

1
2
3
4
5
6
7
rows: gql`query {

  iwRegions {

    id

    country_id

    name

  }

}

is sending an auto-injected '__typename' column request through to my SQL backend server, which naturally has no idea what to do with it.

I tried implementing a suggestion to filter out the _typename as follows, but it has no effect on the problem:

1
2
3
4
5
6
7
8
9
10
graphQLServer.use('/graphql', graphqlExpress({

  schema: graphQlSchema,

  formatParams: (params) => {

    const { variables, ...rest } = params;

    return {

      variables: omitDeep(variables, '__typename'),

      ...rest

    }

  }

}));

Can you offer any ideas on this?

TIA
Adrian

该提问来源于开源项目:vuejs/vue-apollo

The problem was in my objection-graphql middleware, it just needed to filter out the __typename 'column'. Solved!





   



推荐阅读
author-avatar
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有