【问题标题】:Use empty strings with AWS Amplify API and DynamoDB在 AWS Amplify API 和 DynamoDB 中使用空字符串
【发布时间】:2020-03-20 17:58:55
【问题描述】:

我开始将 AWS Amplify 用于 Web 应用程序。

我按照Getting Started tutorial 的建议使用 DynamoDB 数据源配置了 AppSync GraphQL。

我的一个值是一个空字符串,在尝试插入时出现此错误

"One or more parameter values were invalid: An AttributeValue may not contain an empty string (Service: AmazonDynamoDBv2; Status Code: 400; Error Code: ValidationException; Request ID: 0000000SOMETHING0000000)"

似乎可以通过将选项 convertEmptyValues: true 传递给 DynamoDB 客户端来解决。你知道我如何使用 AppSync 传递这样的选项吗?

【问题讨论】:

    标签: amazon-web-services amazon-dynamodb aws-amplify


    【解决方案1】:

    我在 Amplify 代码库中没有找到这样的选项。我希望它会被添加。

    与此同时,我以这种方式传递我的空字符串:

    {
      id: id,
      title: title,
      description: description || null
    }
    

    【讨论】:

      猜你喜欢
      • 2019-10-19
      • 2019-04-21
      • 2020-06-07
      • 2016-08-23
      • 1970-01-01
      • 1970-01-01
      • 2022-10-22
      • 1970-01-01
      • 2023-01-17
      相关资源
      最近更新 更多