Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Goose fails with AWS Bedrock with httpx 0.28.1, but is working with older 0.27.2 #438

Open
VasilijP opened this issue Dec 10, 2024 · 2 comments

Comments

@VasilijP
Copy link

As title says:

httpx.HTTPStatusError: Client error '403 Forbidden' for url 'https://bedrock-runtime.us-east-1.amazonaws.com/model/anthropic.claude-3-5-sonnet-20240620-v1:0/converse'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403
{"message":"The request signature we calculated does not match the signature you provided. Check your AWS Secret Access Key and signing method. Consult the service documentation
for details."}

When using Claude 3.5 on Amazon Bedrock and goose-ai 0.9.11, works with httpx==0.27.2, but fails with error above when using httpx==0.28.1

@michaelneale
Copy link
Collaborator

odd - @VasilijP most of the net new work is on v1.0 branch which shoudlnt' have this issue (as not using python and thus httpx).

@reproduce-bot
Copy link

The following script was generated by AI Agent to reproduce the bug in this issue:

# goose/reproduce.py
import httpx

def test_bedrock_request():
    try:
        url = 'https://bedrock-runtime.us-east-1.amazonaws.com/model/anthropic.claude-3-5-sonnet-20240620-v1:0/converse'
        headers = {
            "Authorization": "Bearer YOUR_AWS_SECRET_ACCESS_KEY",
            "Content-Type": "application/json"
        }
        payload = {
            "input": "Hello, how are you?"
        }
        
        response = httpx.post(url, headers=headers, json=payload)
        response.raise_for_status()  # This will raise an HTTPStatusError for status codes 4xx/5xx
        print("Test passed successfully with no errors!")

    except httpx.HTTPStatusError as e:
        raise AssertionError(e)

if __name__ == "__main__":
    test_bedrock_request()

How to run:

python3 goose/reproduce.py

Expected Result:

Traceback (most recent call last):
  File "goose/reproduce.py", line 15, in test_bedrock_request
    response.raise_for_status()  # This will raise an HTTPStatusError for status codes 4xx/5xx
  File "/usr/local/lib/python3.10/site-packages/httpx/_models.py", line 829, in raise_for_status
    raise HTTPStatusError(message, request=request, response=self)
httpx.HTTPStatusError: Client error '403 Forbidden' for url 'https://bedrock-runtime.us-east-1.amazonaws.com/model/anthropic.claude-3-5-sonnet-20240620-v1:0/converse'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "goose/reproduce.py", line 22, in <module>
    test_bedrock_request()
  File "goose/reproduce.py", line 19, in test_bedrock_request
    raise AssertionError(e)
AssertionError: Client error '403 Forbidden' for url 'https://bedrock-runtime.us-east-1.amazonaws.com/model/anthropic.claude-3-5-sonnet-20240620-v1:0/converse'
For more information check: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status/403

Please review the usefulness of this reproduction script. We hope this script is helpful for maintainers to reproduce, localize and fix the issue, and has the potential to enhance the test suite.

Note that the script is generated by large language models. Use the generated code with cautions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants