question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How do I mock dynamoDB.DocumentClient batchWrite? "Requested resource not found"

See original GitHub issue

This is my pattern on all, works for ‘get’ ‘put’ ‘delete’ and so on. But when I try to mock batchWrite it doesn’t find my mockup. Have also tried ‘batchWriteItem’ does not work.

AWS.mock('DynamoDB.DocumentClient', 'batchWrite', (params: any, callback: any) => callback(null, {}));

Anyone know how?

Issue Analytics

  • State:open
  • Created 5 years ago
  • Reactions:2
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

4reactions
zkrigecommented, Nov 25, 2019

Is there any plans to mock batchWrite on DynamoDB.DocumentClient

0reactions
chinitotuchmancommented, Jul 29, 2020

from the aws docs:

Puts or deletes multiple items in one or more tables by delegating to AWS.DynamoDB.batchWriteItem().

so @kevinrambaud was right, i was able to mock using a sinon stub doing this:

const dynamoBatchWriteStub = sinon.stub().resolves(WHATEVER)
AWS.mock('DynamoDB', 'batchWriteItem', dynamoBatchWriteStub)

fwiw, this will only apply to dynamoDb.DocumentClient.batchWrite().promise()

Read more comments on GitHub >

github_iconTop Results From Across the Web

AWS DynamoDB resource not found exception - Stack Overflow
I got Error warning Lambda : lifecycleIteration=0 lambda handler returned an error: ResourceNotFoundException: Requested resource not found.
Read more >
Error handling with DynamoDB - AWS Documentation
Message: Requested resource not found. Example: The table that is being requested does not exist, or is too early in the CREATING state....
Read more >
A brand new website interface for an even better experience!
How do I mock dynamoDB.DocumentClient batchWrite? "Requested resource not found"
Read more >
[Solved] AWS DynamoDB errors ResourceNotFoundException
DynamoDB responds with this error when you're trying to run an operation against non-existent or not active table. Troubleshooting steps:.
Read more >
Using with DynamoDB - Jest
Jest DynamoDB provides all required configuration to run your tests using ... const {DocumentClient} = require('aws-sdk/clients/dynamodb');
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found