Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .stats.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
configured_endpoints: 19
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-5e4716f7fce42bbcecc7ecb699c1c467ae778d74d558f7a260d531e2af1a7f30.yml
openapi_spec_hash: f545dcef9001b00c2604e3dcc6a12f7a
config_hash: 65328ff206b8c0168c915914506d9dba
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel%2Fkernel-9f2d347a4bcb03aed092ba4495aac090c3d988e9a99af091ee35c09994adad8b.yml
openapi_spec_hash: 73b92bd5503ab6c64dc26da31cca36e2
config_hash: aafe2b8c43d82d9838c8b77cdd59189f
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,13 @@ await client.browsers.create({ persistence: { id: 'browser-for-user-1234' } }, {

### Timeouts

Requests time out after 1 minute by default. You can configure this with a `timeout` option:
Requests time out after 5 seconds by default. You can configure this with a `timeout` option:

<!-- prettier-ignore -->
```ts
// Configure the default for all requests:
const client = new Kernel({
timeout: 20 * 1000, // 20 seconds (default is 1 minute)
timeout: 20 * 1000, // 20 seconds (default is 5 seconds)
});

// Override per-request:
Expand Down
4 changes: 0 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,6 @@
"typescript": "5.8.3",
"typescript-eslint": "8.31.1"
},
"imports": {
"@onkernel/sdk": ".",
"@onkernel/sdk/*": "./src/*"
},
"exports": {
".": {
"import": "./dist/index.mjs",
Expand Down
6 changes: 3 additions & 3 deletions src/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ export class Kernel {
* @param {string | undefined} [opts.apiKey=process.env['KERNEL_API_KEY'] ?? undefined]
* @param {Environment} [opts.environment=production] - Specifies the environment URL to use for the API.
* @param {string} [opts.baseURL=process.env['KERNEL_BASE_URL'] ?? https://api.onkernel.com/] - Override the default base URL for the API.
* @param {number} [opts.timeout=1 minute] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
* @param {number} [opts.timeout=5 seconds] - The maximum amount of time (in milliseconds) the client will wait for a response before timing out.
* @param {MergedRequestInit} [opts.fetchOptions] - Additional `RequestInit` options to be passed to `fetch` calls.
* @param {Fetch} [opts.fetch] - Specify a custom `fetch` function implementation.
* @param {number} [opts.maxRetries=2] - The maximum number of times the client will retry a request.
Expand Down Expand Up @@ -207,7 +207,7 @@ export class Kernel {
}

this.baseURL = options.baseURL || environments[options.environment || 'production'];
this.timeout = options.timeout ?? Kernel.DEFAULT_TIMEOUT /* 1 minute */;
this.timeout = options.timeout ?? Kernel.DEFAULT_TIMEOUT /* 5 seconds */;
this.logger = options.logger ?? console;
const defaultLogLevel = 'warn';
// Set default logLevel early so that we can log a warning in parseLogLevel.
Expand Down Expand Up @@ -761,7 +761,7 @@ export class Kernel {
}

static Kernel = this;
static DEFAULT_TIMEOUT = 60000; // 1 minute
static DEFAULT_TIMEOUT = 5000; // 5 seconds
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a significant behavioral change that reduces the default timeout by 92% (from 60s to 5s). This could potentially break existing applications that rely on operations taking longer than 5 seconds. Consider if this should be documented as a breaking change rather than a patch release, especially since users who haven't explicitly set a timeout will suddenly experience much shorter timeouts.

Type: Logic | Severity: Medium


static KernelError = Errors.KernelError;
static APIError = Errors.APIError;
Expand Down