小编ben*_*o_h的帖子

AWS step-function mapState iterate over large payloads

I have a state-machine consisting of a first pre-process task that generates an array as output, which is used by a subsequent map state to loop over. The output array of the first task has gotten too big and the state-machine throws the error States.DataLimitExceeded: The state/task 'arn:aws:lambda:XYZ' returned a result with a size exceeding the maximum number of characters service limit.

Here is an example of the state-machine yaml:

stateMachines:
  myStateMachine:
    name: "myStateMachine"
    definition:
      StartAt: preProcess
      States:
        preProcess: …
Run Code Online (Sandbox Code Playgroud)

amazon-web-services aws-lambda aws-step-functions aws-serverless

6
推荐指数
1
解决办法
3233
查看次数

AWS Lambda 中 id_token 与 access_token 使用的最佳实践

考虑由 AWS-ApiGateway 和 -Lambda 组成的restapi 后端。

成功进行 oauth2 身份验证后,AWS Cognito在代码授权授予流程中向客户端返回 anaccess_token和 an 。id_token

在API调用期间,lambda函数需要知道经过身份验证的客户端的电子邮件地址,所以我基本上有两种选择:

  1. 发送由 ApiGateway 验证并传递给 Lambda 的标头id_tokenAuthorization让 Lambda 解密id_token并访问其中包含的电子邮件地址。
  2. 发送由 ApiGateway 验证并传递给 Lambda 的access_token标头。让 Lambda 使用头中的access_token 调用端点以获取电子邮件地址。Authorizationscope=openid emailGET/oauth2/userinfoAuthorization

两者哪一个是最佳实践?为什么?

openid authentication amazon-web-services oauth-2.0

3
推荐指数
1
解决办法
2876
查看次数

Typescript JSON 模式对象的类型

打字稿中是否有与 JSON 模式对象关联的特殊类型?我的班级有一个方法可以检查其成员是否满足动态 json 模式schema,现在我是这样做的,

<!-- language: typescript -->

verifySchema(schema: object): void {
    // do verification
}
Run Code Online (Sandbox Code Playgroud)

例如在哪里

<!-- language: typescript -->

const schema = {
  title: 'blabla',
  description: 'Basic schema',
  type: 'object',
  properties: {
    "firstName": {
    "type": "string",
    "description": "The person's first name."
    },
    "lastName": {
    "type": "string",
    "description": "The person's last name."
    },
...
}
Run Code Online (Sandbox Code Playgroud)

但是为了保持通用性,我想允许检查任意的 json 模式,而不仅仅是这个特定的模式。是否可以schema: object为 JSON 模式对象设置或有最佳实践?

javascript json typescript

2
推荐指数
1
解决办法
1990
查看次数