aws-samples / bedrock-claude-chat

AWS-native chatbot using Bedrock + Claude (+Mistral)
MIT No Attribution
688 stars 232 forks source link

[BUG] An error occurred while responding behind proxy #332

Closed tis-abe-akira closed 4 weeks ago

tis-abe-akira commented 1 month ago

Describe the bug

To limit access from within the company, we are using a PROXY server for access. Because of this, when sending prompts from the chat, we frequently encounter the message "An error occurred while responding." After pressing ”Resend”, it works normally. Therefore, while chat usage is possible, but, we consider this to have significant usability issues.

If this can be improved through configuration settings, please let us know. Ideally, we hope for an improvement.

To Reproduce

  1. Enter the prompt.
  2. Press the Enter key to submit the request.
  3. The following error occurs quite frequently in the screenshots.
  4. Pressing the "Resend" button results in a normal response.

Screenshots

bedrock_claude_chat_issue

Additional context

N/A

statefb commented 1 month ago

Thank you for reporting this issue. Have you checked log yet? If not, could you take a trouble to find abnormal behavior? The name of log looks like: /aws/lambda/BedrockChatStack-WebSocketHandlerXXXX

tis-abe-akira commented 1 month ago

Thank you for your reply. To be honest, your response allowed me to locate the logs. When I checked the logs, there were no ERROR level log entries, only INFO level ones at the time this issue occurred.

I don't understand which part of the logs I should send to help resolve the issue. Could you please advise me?

tis-abe-akira commented 1 month ago

The following errors are occurring when viewed through the Developer Tool in WebBrowser (FireFox):

  1. Could not establish a connection to the server at wss://xxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/dev.

  2. error { target: WebSocket, isTrusted: true, srcElement: WebSocket, currentTarget: WebSocket, eventPhase: 2, bubbles: false, cancelable: false, returnValue: true, defaultPrevented: false, composed: false, … }
    bubbles: false
    cancelBubble: false
    cancelable: false
    composed: false
    currentTarget: null
    defaultPrevented: false
    eventPhase: 0
    explicitOriginalTarget: WebSocket { url: "wss://xxxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/dev", readyState: 3, bufferedAmount: 0, … }
    isTrusted: true
    originalTarget: WebSocket { url: "wss://xxxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/dev", readyState: 3, bufferedAmount: 0, … }
    returnValue: true
    srcElement: WebSocket { url: "wss://xxxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/dev", readyState: 3, bufferedAmount: 0, … }
    target: WebSocket { url: "wss://xxxxxxxxxx.execute-api.ap-northeast-1.amazonaws.com/dev", readyState: 3, bufferedAmount: 0, … }
    timeStamp: 190673083
    type: "error"
    <get isTrusted()>: function isTrusted()
    <prototype>: EventPrototype { composedPath: composedPath(), stopPropagation: stopPropagation(), stopImmediatePropagation: stopImmediatePropagation(), … }
  3. 推論中にエラーが発生しました。 index-2a8451ed.js:330:19055 N https://xxxxxxxxxx.cloudfront.net/assets/index-2a8451ed.js:330 (非同期: promise callback) N

I hope this information will be helpful.

statefb commented 1 month ago

Thank you for the detail. Could you check your corporate proxy setting and logs? It likely block webscoket connections.

tis-abe-akira commented 1 month ago

Understood. It seems likely that the issue is caused by our company's proxy. In practice, since it responds correctly upon retransmission, it's a bit inconvenient but not a major problem for practical use. If this is an issue specific to our environment, I think it would be acceptable to close it.