Updated the official JavaScript and TypeScript SDK

The SDK now explains connection failures such as "ECONNRESET" and can retry them automatically.

Changelog1 min read

Written by

Dmytro Krasun

Published on

Version 1.1.25 of the official JavaScript and TypeScript SDK makes connection failures easier to understand and recover from.

A request can fail on the network between your server and the API, for example with ECONNRESET when a proxy, NAT gateway, or firewall closes the connection. Before, the SDK passed on the raw error. Now:

  • Clear connection errors. The SDK throws a ConnectionError that says whether the connection broke before the API responded or while the screenshot was downloading, and what usually causes it.
    • It includes the error code, and the HTTP status when the response had already started.
    • It says how many attempts were made, and how long after the last and the first attempt the connection failed (lastElapsedMs and totalElapsedMs).
  • Automatic retries. Set the maxRetries client option to retry connection resets with exponential backoff. It’s 0 by default.
import * as screenshotone from "screenshotone-api-sdk";
const client = new screenshotone.Client("<access key>", "<secret key>", {
maxRetries: 3,
});

A retry sends the request again. If the API had already finished the first request, the retry renders the screenshot again and counts toward your quota again, unless the result is served from the cache.

Connection resets are more likely when many requests start at once. If you take screenshots in large batches, limit how many requests run at the same time.

Existing error handling keeps working: error.code is still ECONNRESET for connection resets, and API errors are still APIError.

To upgrade, run npm install screenshotone-api-sdk@latest. See the JavaScript and TypeScript examples and the SDK README for error handling.

If you have any questions or suggestions, please contact support@screenshotone.com.

Read more product updates

New features, bug fixes, and optimizations...

View all product updates
Updated the official Go SDK

Updated the official Go SDK

We updated the Go SDK to support the latest API features.

Read more

1 min read

Fail if there is nothing to click on

Fail if there is nothing to click on

A new option has been added to fail or not to fail the screenshot rendering if there is nothing to click on.

Read more

1 min read

Improved blocking of banners for specific websites

Improved blocking of banners for specific websites

We just released an updated version of our algorithm to block banners for specific websites by heuristics.

Read more

1 min read

Automate website screenshots

Exhaustive documentation, ready SDKs, no-code tools, and other automation to help you render website screenshots and outsource all the boring work related to that to us.