# Agent-JS 2.1.3 is Released

**URL:** https://forum.dfinity.org/t/agent-js-2-1-3-is-released/36473
**Category:** JavaScript
**Created:** [October 23, 2024, 5:37pm UTC](https://forum.dfinity.org/t/agent-js-2-1-3-is-released/36473 "2024-10-23T17:37:01Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![anon74414410](https://avatars.discourse-cdn.com/v4/letter/a/85f322/32.png) [@anon74414410](https://forum.dfinity.org/u/anon74414410)
#### Post date: [October 23, 2024, 5:37pm UTC](https://forum.dfinity.org/t/agent-js-2-1-3-is-released/36473/1 "2024-10-23T17:37:01Z")

</div>

## What’s Changed

We have a couple fixes and some improvements to errors in this release.

### Fixes

- Fixed an issue where `read_state` polling requests would fail after the initial expiry, but before the request was processed
  - This was an edge case for subnets under high load. The `read_state` is allowed to use a fresh ingress\_expiry, so `pollForResponse` and `retry` logic now uses this pattern

- Added a check to handle a regression when calling the management canister using the new sync\_call flow

### Error handling

- Fixed an issue where `reject_code` and `reject_message` weren’t passed correctly to the error in synchronous call `reject` or `trap` responses.

- new `ActorCallError` class

- `AgentError` and `ActorCallError` support `instanceof` checks, as well as a `name` attribute that you can use for easier error handling

- chore: Correct the typo in `agent/src/actor.ts` by @AlexV525 in [chore: Correct the typo in `agent/src/actor.ts` by AlexV525 · Pull Request #939 · dfinity/icp-js-core · GitHub](https://github.com/dfinity/agent-js/pull/939)

- fix: trap and throw handling in v3 sync call by @krpeacock in [fix: trap and throw handling in v3 sync call by krpeacock · Pull Request #940 · dfinity/icp-js-core · GitHub](https://github.com/dfinity/agent-js/pull/940)

- fix: read state with fresh expiry by @krpeacock in [fix: read state with fresh expiry by krpeacock · Pull Request #938 · dfinity/icp-js-core · GitHub](https://github.com/dfinity/agent-js/pull/938)

- test: automatically deploys trap canister if it doesn’t exist yet dur… by @krpeacock in [test: automatically deploys trap canister if it doesn't exist yet dur… by krpeacock · Pull Request #942 · dfinity/icp-js-core · GitHub](https://github.com/dfinity/agent-js/pull/942)

- chore: skip range check when the certificate comes from the management canister by @dfx-json in [chore: skip range check when the certificate comes from the management canister · Pull Request #945 · dfinity/icp-js-core · GitHub](https://github.com/dfinity/agent-js/pull/945)

- feat: allow for setting HttpAgent ingress expiry using `ingressExpiryInMinutes` option by @krpeacock in [feat: allow for setting HttpAgent ingress expiry using `ingressExpiryInMinutes` option by krpeacock · Pull Request #905 · dfinity/icp-js-core · GitHub](https://github.com/dfinity/agent-js/pull/905)

- feat: improved assertion options for agent errors by @krpeacock in [feat: improved assertion options for agent errors by krpeacock · Pull Request #908 · dfinity/icp-js-core · GitHub](https://github.com/dfinity/agent-js/pull/908)

**Full Changelog** : [Comparing v2.1.2...v2.1.3 · dfinity/icp-js-core · GitHub](https://github.com/dfinity/agent-js/compare/v2.1.2...v2.1.3)

All changes here: [Release Release 2.1.3 · dfinity/icp-js-core · GitHub](https://github.com/dfinity/agent-js/releases/tag/v2.1.3)
