当前位置:  开发笔记 > 运维 > 正文

错误:与数据源关联的解析器

如何解决《错误:与数据源关联的解析器》经验,为你挑选了1个好方法。

我遇到了无服务器错误: Resolver associated with data sources从serverless.yml配置文件进行构建时:

# serverless.yml
...
mappingTemplates:
  - dataSource: Wallet
    type: Query
    field: walletFromId
    request: "_dynamo-get-wallet.txt"
    response: "_generic-result-response.txt"
  - dataSource: Wallet
    type: Query
    field: walletsFromUser
    request: "_dynamo-get-wallets-from-user.txt"
    response: "_generic-result-response.txt"
  - dataSource: Wallet
    type: Mutation
    field: registerWallet
    request: "_dynamo-put-wallet.txt"
    response: "_generic-result-response.txt"
dataSources:
  - type: AMAZON_DYNAMODB
    name: Wallet
    description: 'Wallet DataSource'
    config:
      tableName: "${self:custom.stage}-Wallet"
      serviceRoleArn: "arn:aws:iam::${self:custom.accountId}:role/${self:custom.appSync.serviceRole}"
...

我也有一个schema.graphql:

type Query {
    # query the wallet with given id and get the output with detail info
    walletFromId(walletId: String!): Wallet!
    # query wallets with given user id and get list of cards
    walletsFromUser(userId: String!): [Wallet!]!
}

type Mutation {
    # Add a wallet to an existing user
    registerWallet(userId: String!, number: String!, cvx: String!, expirationDate: String!): Wallet!
}
type Wallet {
    walletId: String!
    userId: String!
    number: String!
    cvx: String!
    expirationDate: String!
}

type Subscription {
    addWallet: Wallet
    @aws_subscribe(mutations: ["registerWallet"])
}

schema {
    query: Query
    mutation: Mutation
    subscription: Subscription
}

对于该错误的含义,我找不到任何线索,而且从构建日志中也找不到其他任何东西。



1> mparis..:

此错误通常表示您正在尝试删除解析器当前正在使用的数据源。如果您可以识别指向数据源的解析器并将其删除,那么您将不再看到错误消息。

推荐阅读
wurtjq
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有