🐞

Debugging requests to DynamoDB

Sep 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:

  1. Install proxy-agent using npm i proxy-agent (you can remove this later).
  2. Configure the AWS SDK to use the local proxy that Fiddler sets up on launch
  3. 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.

Fiddler showing several requests to DynamoDB, with the JSON Inspector displaying the request.
Fiddler showing several requests to DynamoDB, with the JSON Inspector displaying the request.

⚠️

Remember to remove that snippet and uninstall proxy-agent before you commit & push ;)