Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DynamoDB DocumentClient :: Missing "context" attribute in NewImage and concurrent loop handling #282

Open
remedyal opened this issue Oct 18, 2021 · 0 comments

Comments

@remedyal
Copy link

Questions

Hello, I have questions about the usage of lambda-powertools-dynamodb-client:

  1. When a record is modified, shouldn't there be "context" attribute in the NewImage?
    I have examined the logs of the lambda that are triggered by the Stream, and I cannot get the latest "context" directly from the received event. In order to do that, I have to execute a "get" request to the said record. Am I missing something (configurations, etc.) or is this actually the appropriate/correct way to do it?

  2. How to handle multiple loops that update a record at the same time?
    I have a case when a record is updated by more than one loop at a moment. I am expecting that there will be multiple maps inside the "context" in the said record, that can be extracted by the loops using the correlation id, respectively. However, it only stores a map, and the values associated with a loop are overwritten by the other loop. Do you have advice regarding this matter?

Thank you for your assistance.

Additional Data

  • Which powertool package are you using?:
    @dazn/lambda-powertools-dynamodb-client

  • Which version are you using?:
    1.28.1

  • Middy version you're using:
    0.36.0

  • Operating System:
    AWS Lambda / NodeJS

  • Logs:
    Related to the question 1

 NewImage: {
    PartitionKey: {
      S: "0e100915-80a5-4452-99ff-d4f8056c12d9",
    },
    UpdatedAt: {
      S: "2021-10-08T06:19:07.556Z",
    },
  },
  OldImage: {
    __context__: {
      M: {
        awsRequestId: {
          S: "b1f0efcc-d6f8-4862-96a6-39ec79328288",
        },
        "x-correlation-id": {
          S: "5ad8fc1c-498e-4cae-b60a-82efd284cc92",
        },
        "call-chain-length": {
          N: "3",
        },
        "debug-log-enabled": {
          S: "true",
        },
      },
    },
    PartitionKey: {
      S: "0e100915-80a5-4452-99ff-d4f8056c12d9",
    },
    UpdatedAt: {
      S: "2021-10-08T06:19:06.590Z",
    },
  },
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant