Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 是否可以使用AppSync VTL使用BatchPutItem(BatchWriteItem)在DynamoDB上插入超过25个项目?_Reactjs_Amazon Dynamodb_Apollo_Aws Appsync_Vtl - Fatal编程技术网

Reactjs 是否可以使用AppSync VTL使用BatchPutItem(BatchWriteItem)在DynamoDB上插入超过25个项目?

Reactjs 是否可以使用AppSync VTL使用BatchPutItem(BatchWriteItem)在DynamoDB上插入超过25个项目?,reactjs,amazon-dynamodb,apollo,aws-appsync,vtl,Reactjs,Amazon Dynamodb,Apollo,Aws Appsync,Vtl,只是为了一些背景:目前正在使用AppSync+React+Apollo,我正试图通过AppSync的ApacheVTL发送38-40个项目进行更新 我知道DynamoDB限制了插入到的项目数量,但我认为AppSync没有这些限制。我猜我错了,因为每当我发送超过25个项目(26+)时,我的请求就会失败 以下是我的VTL脚本: #设置($isTenantValid=false) #foreach($context.identity.claims中的租户)[”https://app.schon.io/

只是为了一些背景:目前正在使用AppSync+React+Apollo,我正试图通过AppSync的ApacheVTL发送38-40个项目进行更新

我知道DynamoDB限制了插入到的项目数量,但我认为AppSync没有这些限制。我猜我错了,因为每当我发送超过25个项目(26+)时,我的请求就会失败

以下是我的VTL脚本:

#设置($isTenantValid=false)
#foreach($context.identity.claims中的租户)[”https://app.schon.io/tenants"])
#如果($tenant==$ctx.args.tenantId)
#设置($isTenantValid=true)
#结束
#结束
##需要验证员工是否具有插入学生的权限。
#如果(!$isTenantValid)
$utils.unauthorized()
#结束
#设置($itemsToPut=[]))
#set($pk=“tenant:${ctx.args.tenantId}”)
#set($userSK=“tenant:${ctx.args.tenantId}:学年:${ctx.args.schoolyar}”)
#foreach($ctx.args.students中的student)
#set($studentId=“${util.autoId()}”)
#set($sk=“学年:${ctx.args.schoolyar}:student:${studentId}”)
#set($userPK=“student:${studentId}”)
#设置($item={
“pk”:$pk,
“sk”:$sk,
“id”:$studentId,
“userPK”:$userPK,
“userSK”:$userSK,
“姓名”:{
“firstName”:$student.name.firstName,
“lastName”:$student.name.lastName,
“全名”:“${student.name.firstName}${student.name.lastName}”
},
“学年”:$ctx.args.schoolyar,
“createdAt”:${util.time.nowEpochSeconds()},
“updatedAt”:${util.time.nowEpochSeconds()},
“性别”:$student.gender,
“退休”:$student.retired
})
#如果(“${student.diseases}”!=”)
$util.qr($item.add(“疾病“,$student.diseases))
#结束
#如果(“${student.email}”!=”)
$util.qr($item.add(“email”、$student.email))
#结束
#如果(“${student.birthdate}”!=”)
$util.qr($item.add(“生日“,$student.birthdate))
#结束
$util.qr($itemsToPut.add($util.dynamodb.toMapValues($item)))
#结束
{
“版本”:“2018-05-29”,
“操作”:“BatchPutItem”,
“表格”:{
“SchonDB”:$utils.toJson($itemsToPut)
}
}

在这种情况下,我是否需要将其卸载到Lambda并按25项执行发送和重试逻辑?

您能否尝试联系DDB团队为您增加服务限制?

您能否尝试联系DDB团队为您增加服务限制?

这取决于您的DDB的写入容量单元(WCU)和负载大小。@Joseph。可能吗?这些文档明确地说:“对BatchWriteItem的一次调用可以写入多达16MB的数据,其中可以包含多达25个put或delete请求。”我还有DynamoDB来自动配置WCU和RCUsNo。请参阅。这取决于DDB的写入容量单位(WCU)和有效负载大小。@JosephD。可能吗?这些文档明确地说:“对BatchWriteItem的一次调用可以写入多达16MB的数据,其中可以包含多达25个put或delete请求。”我还有DynamoDB来自动配置WCU和RCUsNo。看。你是说亚马逊网络服务AWS?是的,AWS客户支持。很抱歉再也不回来了!我最终通过lambda解析器部署了它!所以我从来没有联系过AWS。你是说亚马逊网络服务AWS?是的AWS客户支持。很抱歉再也没有回来!我最终通过lambda解析器部署了它!所以我从未联系过AWS。