Skip to content

Debugging

Daniel Lamando edited this page Dec 21, 2021 · 2 revisions

As of aws-api.deno.dev/v0.2 / /x/[email protected], there is no native debug-logging functionality built into this library.

For debugging in small programs for the purposes of reproducing an issue, consider replacing fetch(), for example:

const realFetch = globalThis.fetch;
globalThis.fetch = async (req, init) => {
  console.log('-->', (req as any).url);
  const resp = await realFetch(req);
  const body = await resp.text();
  console.log('<--', body);
  return new Response(body, resp);
}

the future

The latest code in git will allow snooping on requests more properly, like this:

const loggedFactory = new ApiFactory({
  extras: {
    mutateRequest: async (req) => {
      const body = await req.text();
      console.log('-->', body);
      return new Request(req, { body });
    },
  },
})
const ec2 = loggedFactory.makeNew(EC2);
Clone this wiki locally