ref(aws-serverless): Vendor aws-sdk instrumentation#20978
Conversation
Closes #20514 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit b1be2ff. Configure here.
|
|
||
| if (request.commandInput?.body) { | ||
| const requestBody = JSON.parse(request.commandInput.body); | ||
| if (modelId.includes('amazon.titan')) { |
There was a problem hiding this comment.
Undefined modelId crashes on .includes() call
Medium Severity
In requestPreSpanHookInvokeModel, modelId is obtained via optional chaining (request.commandInput?.modelId) and can be undefined. The code enters the if (request.commandInput?.body) block without re-checking modelId, then calls modelId.includes('amazon.titan') which throws a TypeError if modelId is undefined. The same pattern exists in responseHookInvokeModel where currentModelId is used without a null guard before calling .includes().
Additional Locations (1)
Reviewed by Cursor Bugbot for commit b1be2ff. Configure here.


Vendors
@opentelemetry/instrumentation-aws-sdkinto the SDK with no logic changes.TokenUsageandConverseStreamOutputtypes from@aws-sdk/client-bedrock-runtimeare inlined as simplified interfaces to avoid requiring the package as a dependency.Closes #20514