Releases: temporalio/sdk-typescript
1.11.2
Important ⚠️ ⚠️ ⚠️
- This release fixes a bug in 1.11.0 and 1.11.1 that may result in Workflows failing to replay with the very same code.
We urge users who are already using v1.11.0 or v1.11.1 to promptly upgrade to this release.
Bug Fixes
- [
workflow
] Workflow Activation Encoder was discarding SDK flags (#1530) - [
core
] Respect gRPC timeouts on get wf execution history (temporalio/sdk-core#812) - [
core
] Attempt to address unusal rpc cancellation error (temporalio/sdk-core#811) - [
core
] Fix legacy query failure replying (temporalio/sdk-core#809) - [
core
] Fix possible NDEs caused by LAs & immediate cancels resolving in different order upon replay (temporalio/sdk-core#808) - [
workflow
] Fix potential incoherencies in Workflow Activation Jobs ordering (#1513, temporalio/sdk-core#789) - [
core
] Include Search Attribute updates made in-workflow when continuing as new (temporalio/sdk-core#797) - [
core
] Add basic validation on Activity Tasks (temporalio/sdk-core#795) - [
core
] Do not send queries after we would fail WFT (temporalio/sdk-core#792)
Dependencies
Thanks
- Thanks to Ilya Priven for multiple docs improvements (#1507, #1525, #1527, #1524).
1.11.1
1.11.0
Bug Fixes
- Fix flakes in Worker Tuner and Workflow Update tests (#1463)
- [
workflow
] Don't propagate cancellation from non-cancellable scopes to children (#1429) - [
worker
] Don't fail Worker on Activity Task decode failures (port from #1473) (#1477) - [
ci
] Enable file-based persistence on dev server for stress tests (#1480) - [
workflow
] Fix cancel-before-started abandon activity (#1487) - [
doc
] Docs were no longer being built and deployed in CI (#1494) - [
workflow
] Process all activation jobs as a single batch (#1488)
Documentation
- Clarify some drawbacks of ephemeral servers, and other minor fixes (#1478)
Features
Resource-based Worker Auto-tuning (EXPERIMENTAL)
Experimental support for worker tuning has been added along with an implementation for auto-tuning based on available
resources. WorkerOptions
now has a tuner
field that can be set to a WorkerTuner
. This is composed of SlotSupplier
s, of which currently FixedSize
and ResourceBased
are available. ResourceBased
tuners change the number of available slots dynamically based on resource usage. For some examples of initializing the worker tuner, see here.
At some point the SlotSupplier
interface will be manually implementable, but only fixed-size and resource-based slot suppliers are currently supported. Custom slot suppliers will appear in the future.
This SDK API is experimental and may change in incompatible ways in the future.
- [
workflow
] Unify GRPC::CANCELED and DEADLINE_EXCEEDED in an SDK Timeout exception for Update (#1452) - [
workflow
] Expose updateId to update handlers (#1450) - [
workflow
] Add upsert memo command (#1321)
Miscellaneous Tasks
- Bump GHA runner for stress tests (#1492)
Client
- Make gRPC INTERNAL status retryable (#1455)
1.10.3
v1.10.2
v1.10.1
v1.10.0
Important updates
-
💥 Support for Node.js 14 and older GLIBC releases has been dropped. As announced previously, TS SDK v1.9 was the last minor release to support Node.js 14.
Going forward, the TypeScript SDK requires:
- Node.js 16.15 or more recent;
- GLIBC 2.35 or more recent (update: we restored compatibility with GLIBC 2.18 in v1.10.1)
-
💥 Support for Node.js 16 will soon be dropped. TS SDK v1.10 will be the last minor release to support Node.js 16. TS SDK v1.11 will require Node 18 or higher.
Node.js 14 officially reached end-of-life on April 30th, 2023, and Node.js 16 reached end-of-life on September 11th, 2023 (see Node.js release schedule). We strongly encourage everyone to take immediate action in updating their deployments to supported versions of Node.js to ensure continued compatibility and receive the latest features and security updates.
Features
-
[
client
] BothConnection
andNativeConnection
now accept anapiKey
option, making it easier to connect to Temporal Cloud and other Temporal servers that use bearer token authentication (#1385), as well as HTTP CONNECT Proxy (#1411, thanks to @brendan-myers for his help on getting this started 🙏). -
[
client
] Thestartdelay
Workflow option is no longer experimental (#1379). Thanks @tlafano 🙏. -
[
core
] Core can now be configured to emit duration metrics as either seconds or milliseconds, as well as to include unit suffixes in metric names (#1383). -
[
worker
] AddtaskQueue
andlogSource
metadata attributes on all log messages emitted inside the context of a worker. These attributes are there make is easier to diagnose some low level issues, as well as allow implementing fine-grained filtering of messages (eg. show DEBUG level messages for user-code, but only WARN for messages from the worker) (#1391).
Bug Fixes
-
[
client
] Bring gRPC retry options in line with other SDKs (#1368). Thanks to @chronos-tachyon 🙏. -
[
worker
] Unreference timer created inparseWorkflowCode
(#1370). Thanks @jhecking 🙏. -
On POSIX systems,
stdout
andstderr
are now properly inherited by ephemeral servers (e.g.TestWorkflowEnvironment.createLocal()
andTestWorkflowEnvironment.createTimeSkipping()
), making it easier to diagnose issues while creating a test environment (#1394). -
@grpc/grpc-js
has been updated to 1.10.x (#1388). It had previously been pinned to 1.7.3 to avoid multiple bugs and incompatibilities introduced ingrpc-js
1.8.0. We have since reviewed these changes and confirmed that there is no longer any reason to refrain form updating that dependency. -
bundler
: Webpack output is now recorded as a single log entry, and color are disabled if output is not being sent to the console (#1414). Thanks @ikonst 🙏. -
MockActivityEnvironment
no longer causes initialization of theRuntime
(#1401). -
[
common
] Improve error messages forfailureConverters
(#1373). -
[
doc
] Fix comment on defaultmaxConcurrentActivityTaskPolls
value (#1374) Thanks @taonic 🙏.
v1.9.3
Bug fixes
- Fix deprecated patch removal when no subsequent command (temporalio/sdk-core#671).
- Fix incorrect ordering of a query execution that could happen if new workflow tasks came in while there were buffered queries (temporalio/sdk-core#673).
- Fix a possibility of sending local activity marker after the Workflow Task Complete command (temporalio/sdk-core#678).
- Wait for activity completes to reach server before shutdown (temporalio/sdk-core#681).
- Update protobuf definitions to work with the new
EVENT_TYPE_WORKFLOW_EXECUTION_UPDATE_REQUESTED
event (temporalio/sdk-core#677). - Fix a regression regarding gRPC incoming message limit due to a behavior change in tonic 0.9.0.
Documentation
- Avoid doctype reexports canonicalization issue (#1354)
Miscellaneous Tasks
- Add test for module property mutation isolation (#1356)
v1.9.1
Bug Fixes
- [
worker
] Fix prometheus and otel regressions (#1345) - Fix
devDependencies
in some of the SDK packages where file URLs were used instead of version numbers.
Documentation
- Add note on custom conveters and bundleWorkflowCode (#1338)
- Fix sort order + snipsync examples issue (#1341)
- [
worker
] Update webpack error doc link in worker/bundler.ts (#1344) - Explain the purpose of
updateId
(#1318)
Features
- [
worker
] Add a workflow metadata query (#1319)
v1.9.0
Important updates
-
The
reuseV8Context
worker option is now enabled by default. This major optimization of the Workflow sandboxing runtime significantly reduces RAM and CPU usage, without compromising the safety of the deterministic sandbox. You may still revert to the legacy execution model by addingreuseV8Context: false
to your worker options.Note that support for the legacy, non-
reuseV8Context
execution model may be removed at some point in the future. Please reach out if you find any issue that requires disablingreuseV8Context
. -
Support for Node.js 14 and Node.js 16 will soon be dropped. Node.js 14 officially reached end-of-life on April 30th, 2023, and Node.js 16 reached end-of-life on September 11th, 2023 (see Node.js release schedule).
This has since then caused a rippling effect, as more and more libraries in the NPM ecosystem are progressively dropping support for both of those older targets. Given that challenges to maintaining compatibility with these outdated Node.js releases will only continue to grow, it is evident that we will soon need to follow suit in discontinuing support for Node.js 14 and 16 in the Temporal TypeScript SDK.
For those reasons:
- TS SDK v1.9 will be the last minor release to support Node.js 14.
- TS SDK v1.10 could possibly be the last minor release to support Node.js 16. Note that this also implies that GLIBC 2.27 will no longer be supported from that point on, since Node.js 18+ won’t compile on GLIBC older than 2.28.
We strongly encourage everyone to take immediate action in updating their deployments to supported versions of Node.js to ensure continued compatibility and receive the latest features and security updates.
New & Noteworthy
Support for Workflow Update (experimental)
-
Introduced Workflow Update APIs, both on Workflow side and Client side (#1277, #1312 and #1320). Kudos to @dandavison 🙏.
⚠️ The Workflow Update feature is currently in pre-release stage. Related APIs are considered experimental and may change in the near future. This feature requires Temporal Server version 1.21 or later, and must be enabled through configuration.Here are some examples to get started:
// An Update is defined similarly to Query and Signal. The second type parameter (input) is optional const myUpdate = wf.defineUpdate<string, [string]>('myUpdate'); // A handler is a sync or async function; the optional validator is always sync. wf.setHandler(myUpdate, handler, { validator }); // `await wfHandle.executeUpdate` to start an update and block until it completes or fails. // The signature resembles `WorkflowClient.start` in that the arguments are supplied // in the optional options object // (as opposed to the variadic signatures of wfHandle.query and wfHandle.signal) // An error is thrown if the RPC times out (we do not poll for this call) // or if the validator rejects, or the handler throws ApplicationFailure. const updateResult = await handle.executeUpdate(myUpdate, { args: ['a'] }); // `startUpdate` to block until Accepted and obtain a handle to the Update. Signature the same as `executeUpdate`. const updateHandle = await handle.startUpdate(myUpdate, { args: ['a'] }); // Blocking call to fetch result, with polling. // Validation failures or ApplicationFailure in the handler would throw here. const updateResult = await updateHandle.result();
Major overhaul of logging support
This release features a major overhaul of Workflow logging, Activity logging support, and Core log forwarding support.
These changes add up to better DX, notably by promoting clear usage patterns that work out of the box, removing the need to use insufficiently documented features, and removing some requirements that were error-prone and a recurring source of support questions.
Workflow Logging
-
Calling
appendDefaultInterceptors()
when registering custom interceptors is no longer required in order for Workflow logger support to work properly.appendDefaultInterceptors()
is now deprecated and behave as a no-op in most cases (i.e. except when a custom logger is supplied in order to redirect log emitted by activities) (#1290). -
Similarly, calling
defaultSink()
when registering custom sinks is no longer required for Workflow logging to work properly (#1283). SDK's logger sink is now forcibly injected. Registering a custom logger sink nameddefaultWorkerLogger
is still supported, but discouraged and deprecated. -
Attributes from the current Workflow are now automatically included as metadata on every log entries emitted using the Workflow context logger, and some key events of the Workflow's lifecycle are now automatically logged (at
DEBUG
level for most messages;WARN
for failures) (#1290). -
WorkflowLogInterceptor
has been deprecated (#1290).
Activity Logging
-
Attributes from the current Activity context are now automatically included as metadata on every log entries emitted using the Activity context logger, and some key events of the Activity's lifecycle are now automatically logged (at
DEBUG
level for most messages;WARN
for failures) (#1284). -
Logged Activity attributes can be customized by registering an
ActivityOutboundCallsInterceptor
that intercepts thegetLogAttributes()
method (#1284). -
ActivityInboundLogInterceptor
has been deprecated; registering such an interceptor with a custom logger still works, but will prevent the use of the newly introducedgetLogAttributes()
interceptor. The same is true about modifying the context logger directly (e.g.context.log = myCustomLogger
) (#1284).
Core Logging
-
Log entries forwarded from Core to TS now retain metadata (#1225).
-
Reduce the default Core log level to
WARN
and non Core Rust logs toERROR
(#1270).
Improvements to Activity-related APIs
-
💥 BREAKING: Non-local activities may now receive cancellation for schedule-to-close and start-to-close timeouts, without heartbeating. Heartbeating is still required to receive server sent cancellations.
-
All APIs provided through
Context.current()
can now be accessed directly from the@temporalio/activity
import (#1252). Also, thanks to @SergeiMeza for fixing a related issue that would occur whenheartbeat
andsleep
functions were destructured out ofContext.current()
(#1249) 🙏.Instead of this:
import { Context } from `@temporalio/activity`; // ... Context.current().sleep('5 minutes');
you can now do:
import { sleep } from `@temporalio/activity`; // ... sleep('5 minutes');
-
ActivityInboundCallsInterceptorFactory
has been deprecated. Activity Interceptors should now be instantiated using anActivityInterceptorsFactory
(#1284). -
MockActivityEnvironment
now accept a list of activity interceptors, and more closely match an actual activity execution (#1284).
Improvements to Client-related APIs
-
Allow specifying gRPC
CallCredentials
on Client connection. Also, fixed the fact thatConnectionOptions.credentials
was completely ignored (#1261). -
Client
andConnection
classes now expose awithAbortSignal()
method. This can be used to cancel all ongoing connections started within a function's scope (#1272).Example:
const ctrl = new AbortController(); setTimeout(() => ctrl.abort(), 10_000); // 👇 throws if incomplete by the timeout. await conn.withAbortSignal(ctrl.signal, () => { /* make client or direct grpc calls */);
-
Add
startDelay
option to workflowstart
,execute
, andsignalWithStart
(#1300).
Miscellaneous
-
WorkerOptions
now exposes anonStickyToStickyPollRatio
property, which controls the proportion of Workflow Task Pollers assigned to polling from Regular Task Queue vs to polling from Sticky Tasks Queues (#1254). -
Fixed a bug that could happen if the
@temporalio/proto
was minimized (#1279). -
Prevents a Workflow-only Worker from requesting Eager Activity Execution for activities schedules on the same task queue name (#1326).