How can I log the full HTTP request and response when using the AWS SDK v3 for Node / javascript?
I was searching for a solution and this what I found:
const { RekognitionClient, ListFacesCommand } = require("@aws-sdk/client-rekognition");
const log4js = require("log4js");
log4js.configure({
appenders: { out: { type: "stdout" } },
categories: { default: { appenders: ["out"], level: "all" } },
});
const logger = log4js.getLogger();
const REGION = process.env.AWS_REGION;
const rkClient = new RekognitionClient({ region: REGION, logger: logger });
In my case, I use Rekognition, but you can use it for all services.
The endpoint is usally https://rekognition.<REGION>.amazonaws.com. See here: https://docs.aws.amazon.com/general/latest/gr/rande.html
To debug the call, you can use a proxy server (like fiddler). You can use CurrPorts with less info.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With