otel-aws-sdk-retry-patch

NodeJS module which adds the traceparent header to the unsignable headers in the aws-sdk.

Usage no npm install needed!

<script type="module">
  import otelAwsSdkRetryPatch from 'https://cdn.skypack.dev/otel-aws-sdk-retry-patch';
</script>

README

otel-aws-sdk-retry-patch

NodeJS module which adds the traceparent header to the unsignable headers in the aws-sdk.


IMPORTANT: The patch function must be called before the aws-sdk is required.


Why do we need this module?

The @opentelemtry/plugin-https breaks the automatic retry of aws requests -> https://stackoverflow.com/questions/64693442/wrong-aws-request-signature-caused-by-opentelemetry-https-plugin

This module is a temporary workaround for the issue described in StackOverflow until there is a better solution.


How does it work?

This module adds traceparent to AWS.Signers.V4.prototype.unsignableHeaders.


How to use the module?

import { patch } from "otel-aws-sdk-retry-patch";

patch();

// Verify that unsignableHeaders contains the traceparent header.
console.log(require("aws-sdk").Signers.V4.prototype.unsignableHeaders);