Repository: promptfoo/promptfoo
Issue: Unable to run promptfoo against AWS Bedrock models with Bedrock Guardrails enabled
Root cause: Documentation Deficiency

**Describe the bug**
I am unable to use AWS Bedrock Guardrails with promptfoo. I receive an error when I enable Guardrails

**To Reproduce**
1. Create Guardrails in AWS Bedrock and note down the id/`arn` and `version`
1. Create a config file with an AWS Bedrock model and enable guardrails, e.g.:
    ```yaml
    id: bedrock:meta.llama3-1-8b-instruct-v1:0
    label: Llama3.1 8b instruct on bedrock
    config:
      region: 'us-west-2'
      guardrailIdentifier: <<YOUR GUARDRAIL ID/ARN>>
      guardrailVersion: <<YOUR GUARDRAIL VERSION>>
    ```
1. Create a simple test/assert in promptfoo
1. Run promptfoo  
1. See error:
```
TypeError: headers[headerName].trim is not a function

TypeError: headers[headerName].trim is not a function
    at getCanonicalHeaders (/usr/local/lib/node_modules/promptfoo/node_modules/@aws-sdk/core/node_modules/@smithy/signature-v4/dist-cjs/index.js:129:58)
    at SignatureV4.signRequest (/usr/local/lib/node_modules/promptfoo/node_modules/@aws-sdk/core/node_modules/@smithy/signature-v4/dist-cjs/index.js:491:30)
    at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
    at async AwsSdkSigV4Signer.sign (/usr/local/lib/node_modules/promptfoo/node_modules/@aws-sdk/core/dist-cjs/submodules/httpAuthSchemes/index.js:106:27)
    at async /usr/local/lib/node_modules/promptfoo/node_modules/@smithy/core/dist-cjs/index.js:169:14
    at async /usr/local/lib/node_modules/promptfoo/node_modules/@smithy/middleware-retry/dist-cjs/index.js:321:38
    at async /usr/local/lib/node_modules/promptfoo/node_modules/@aws-sdk/middleware-logger/dist-cjs/index.js:33:22
    at async AwsBedrockCompletionProvider.callApi (/usr/local/lib/node_modules/promptfoo/dist/src/providers/bedrock.js:588:26)
    at async runEval (/usr/local/lib/node_modules/promptfoo/dist/src/evaluator.js:175:24)
    at async processEvalStep (/usr/local/lib/node_modules/promptfoo/dist/src/evaluator.js:626:25)
```

Simply commenting out the guardrails config will successfully run the test (and PASS).

I tried both `arn` and just the `guardrailsId` but they both result in the same error.

Guardrails works fine from e.g. LlamaIndex or AWS CLI, just not from Promptfoo.

**Expected behavior**
I am expecting the test to at least run (and then either PASS or FAIL)

**Screenshots**
N/A

**System information:**

<img width="205" alt="Image" src="https://github.com/user-attachments/assets/72622bf9-6f38-4d4b-9788-8d211ee5bff7" />

Promptfoo Debug Information:

```JSON
{
  "version": "0.103.19",
  "platform": {
    "os": "darwin",
    "release": "23.6.0",
    "arch": "arm64",
    "nodeVersion": "v22.12.0"
  },
  "env": {},
  "configInfo": {
    "configExists": false,
    "configContent": null
  }
}
```

**Additional context**
Simply commenting out the guardrails config will successfully run the test (and PASS).

I tried both `arn` and just the `guardrailsId` but they both result in the same error.

Guardrails works fine from e.g. LlamaIndex or AWS CLI, just not from Promptfoo.


This seems like a YAML gotcha.  Can you make sure that you've wrapped the `guardrailIdentifier` and `guardrailVersion` values as strings with quotes?

#2981 will do this automatically

Ah, ok, yes, that fixed the issue:

```yaml
id: bedrock:meta.llama3-1-8b-instruct-v1:0
label: Llama3.1 8b instruct on bedrock
config:
  region: 'us-west-2'
  guardrailIdentifier: '123456'
  guardrailVersion: '1'
```

Thanks, closing.