@September 25, 2020
There's probably quite a few ways to debug requests to AWS's (brilliant) DynamoDB from your serverless application, but one of the simplest I've found is to use Fiddler.
This is particularly useful if you're using some kind of library/package to access Dynamo and it would involve stepping through a whole bunch of code to get to the actual requests.
You'll need to do three things:
- Install
proxy-agent
usingnpm i proxy-agent
(you can remove this later). - Configure the AWS SDK to use the local proxy that Fiddler sets up on launch
- Configure the AWS SDK to use plain old HTTP so you don't have to mess around with certificates (I learned the hard way 😢)
import AWS from 'aws-sdk';
import proxy from 'proxy-agent';
AWS.config.update({
sslEnabled: false, // this disables SSL
httpOptions: { agent: proxy('http://127.0.0.1:8888') as any } // this configures the SDK to use the proxy
});
That's it! Build/start up your app and you should start to see the requests coming through in Fiddler. From there, you can access the Inspectors → JSON to see the request being sent to DynamoDB.
Remember to remove that snippet and uninstall
proxy-agent
before you commit & push ;)