fix(ai): try overriding timeout to disable error
Docker Image CI / build-and-push-image (push) Has been cancelled
Maintain Release Merge PR / update-release-pr (push) Has been cancelled
release-please / release-please (push) Has been cancelled
test / test (20.x) (push) Has been cancelled
test / test (22.x) (push) Has been cancelled
test / api-test (22.x) (push) Has been cancelled

The Anthropic SDK preemptively throws an error if it thinks a response
is going to take longer than 10 minutes:
https://github.com/anthropics/anthropic-sdk-typescript#long-requests

According to this documentation, overriding the `timeout` option
disables this error. In this commit the option is changed to the default
value of 10 minutes plus an additional 1 second; it is assumed based on
the documentation's phrasing that it is not necessary to make the
timeout higher but simply to specify a value.
This commit is contained in:
KernelDeimos
2025-09-29 15:08:23 -04:00
parent df6fc8a432
commit 1c64cb274b
@@ -55,7 +55,12 @@ class ClaudeService extends BaseService {
*/
async _init () {
this.anthropic = new Anthropic({
apiKey: this.config.apiKey
apiKey: this.config.apiKey,
// 10 minutes is the default; we need to override the timeout to
// disable an "aggressive" preemptive error that's thrown
// erroneously by the SDK.
// (https://github.com/anthropics/anthropic-sdk-typescript/issues/822)
timeout: 10 * 60 * 1001,
});
const svc_aiChat = this.services.get('ai-chat');