Skip to content

Dynatrace - TypeError on middlewareUserAgent on all versions >= 3.906.0 #7424

@victor-corja

Description

@victor-corja

Checkboxes for prior research

Describe the bug

When we deploy containers that use AWS SDK versions above 3.901.0 for any client, we get an unresolved failure with the following error due to our Dynatrace agent:

TypeError: Function.prototype.apply was called on undefined, which is a undefined and not a function
    at new (/src/node_modules/@aws-sdk/client-s3/dist-cjs/index.js:9054:54)

This was not happening before that, and overriding the version to 3.901.0 resolves the issue, but that is not a scalable solution. The line above resolves specifically to
this.middlewareStack.use(middlewareUserAgent.getUserAgentPlugin(this.config));
for @aws-sdk/client-s3, but this line is present in all clients as it is shared.

Regression Issue

  • Select this option if this issue appears to be a regression.

SDK version number

"@aws-sdk/client-s3": "3.901.0", "@aws-sdk/client-ssm": "3.901.0"

Which JavaScript Runtime is this issue in?

Node.js

Details of the browser/Node.js/ReactNative version

Node 22

Reproduction Steps

I believe this happens during initialization:

export function init() {
    const region = process.env.AWS_REGION || process.env.REGION || 'us-east-1';
    client = new S3Client({ region });
}

Returning:

TypeError: Function.prototype.apply was called on undefined, which is a undefined and not a function
    at Object.dynatraceRegularInvoke [as doInvoke] (/opt/dynatrace/oneagent/agent/bin/1.321.51.20250905-075429/any/nodejs/nodejsagent.js:3042:22)
    at Object.getUserAgentPlugin (/opt/dynatrace/oneagent/agent/bin/1.321.51.20250905-075429/any/nodejs/nodejsagent.js:12647:21)
    at new S3Client (/src/node_modules/@aws-sdk/client-s3/dist-cjs/index.js:9054:54)

Observed Behavior

TypeError: Function.prototype.apply was called on undefined, which is a undefined and not a function
    at Object.dynatraceRegularInvoke [as doInvoke] (/opt/dynatrace/oneagent/agent/bin/1.321.51.20250905-075429/any/nodejs/nodejsagent.js:3042:22)
    at Object.getUserAgentPlugin (/opt/dynatrace/oneagent/agent/bin/1.321.51.20250905-075429/any/nodejs/nodejsagent.js:12647:21)
    at new S3Client (/src/node_modules/@aws-sdk/client-s3/dist-cjs/index.js:9054:54)

Expected Behavior

Successful initialization as with versions 3.901.0 and before.

Possible Solution

No response

Additional Information/Context

No response

Metadata

Metadata

Assignees

Labels

bugThis issue is a bug.closing-soonThis issue will automatically close in 4 days unless further comments are made.p3This is a minor priority issuepotential-regressionMarking this issue as a potential regression to be checked by team memberthird-partyThis issue is related to third-party libraries or applications.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions