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

BatchWriteCommand throwing cannot read properties of undefined 0 #6697

Open
3 of 4 tasks
SureshKumar-sterlingcheck opened this issue Nov 26, 2024 · 3 comments
Open
3 of 4 tasks
Assignees
Labels
bug This issue is a bug. p2 This is a standard priority issue

Comments

@SureshKumar-sterlingcheck
Copy link

SureshKumar-sterlingcheck commented Nov 26, 2024

Checkboxes for prior research

Describe the bug

hi all i amyrying to write 25 items to table, but getting undefined 0 error.
The array has all the data below is the command looks like
any help appreciated

BatchWriteCommand {
  middlewareStack: {
    add: [Function: add],
    addRelativeTo: [Function: addRelativeTo],
    clone: [Function: clone],
    use: [Function: use],
    remove: [Function: remove],
    removeByTag: [Function: removeByTag],
    concat: [Function: concat],
    applyToStack: [Function: cloneTo],
    identify: [Function: identify],
    identifyOnResolve: [Function: identifyOnResolve],
    resolve: [Function: resolve]
  },
  input: { RequestItems: { 'tablename': [Array] } },
  inputKeyNodes: { RequestItems: { '*': [Object] } },
  outputKeyNodes: {
    UnprocessedItems: { '*': [Object] },
    ItemCollectionMetrics: { '*': [Object] }
  },
  clientCommand: BatchWriteItemCommand {
    middlewareStack: {
      add: [Function: add],
      addRelativeTo: [Function: addRelativeTo],
      clone: [Function: clone],
      use: [Function: use],
      remove: [Function: remove],
      removeByTag: [Function: removeByTag],
      concat: [Function: concat],
      applyToStack: [Function: cloneTo],
      identify: [Function: identify],
      identifyOnResolve: [Function: identifyOnResolve],
      resolve: [Function: resolve]
    },
    serialize: [AsyncFunction: se_BatchWriteItemCommand],
    deserialize: [AsyncFunction: de_BatchWriteItemCommand],
    input: { RequestItems: [Object] }
  }
}

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

@aws-sdk/3

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

chrome

Reproduction Steps

write 25 items using batchwriteitem command

Observed Behavior

{"time":1732634274434636343440,"pid":7616,"hostname":"","msg":"Error that occurredqqqqqqqqqqq444444444444444444444444444444444444 in us-east-1 ValidationException: The provided key element does not match the schema"}

Expected Behavior

should write data to table

Possible Solution

No response

Additional Information/Context

No response

@SureshKumar-sterlingcheck SureshKumar-sterlingcheck added bug This issue is a bug. needs-triage This issue or PR still needs to be triaged. labels Nov 26, 2024
@SureshKumar-sterlingcheck SureshKumar-sterlingcheck changed the title BatchWriteItemCommand throwing cannot read properties of undefined 0 BatchCommand throwing cannot read properties of undefined 0 Nov 26, 2024
@SureshKumar-sterlingcheck SureshKumar-sterlingcheck changed the title BatchCommand throwing cannot read properties of undefined 0 BatchWriteCommand throwing cannot read properties of undefined 0 Nov 26, 2024
@zshzbh
Copy link
Contributor

zshzbh commented Nov 27, 2024

Hey @SureshKumar-sterlingcheck ,

Could you please provide minimal code reproduction?

Thanks!

@zshzbh zshzbh self-assigned this Nov 27, 2024
@zshzbh zshzbh added p2 This is a standard priority issue response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. and removed needs-triage This issue or PR still needs to be triaged. labels Nov 27, 2024
@SureshKumar-sterlingcheck
Copy link
Author

SureshKumar-sterlingcheck commented Nov 27, 2024

const data: any = items.map((item: any) => ({
  PutRequest: {
    Item: item
  }
}))

console.debug(Array.isArray(data))

const params = {
  RequestItems: {
    [tableName]: data
  }
}
const command = new BatchWriteItemCommand(params);


const response: any = await this.dynamoDb.send(command);

this is how the console looks like for requesitem table array

{
  PutRequest: {
    Item: Content {
      id: 'temp21313',
        accountId: '000000000000',
}
  }
}

@SureshKumar-sterlingcheck
Copy link
Author

SureshKumar-sterlingcheck commented Nov 27, 2024

this is the minimal code.thank you. @zshzbh

@github-actions github-actions bot removed the response-requested Waiting on additional info and feedback. Will move to \"closing-soon\" in 7 days. label Nov 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug This issue is a bug. p2 This is a standard priority issue
Projects
None yet
Development

No branches or pull requests

2 participants