How to make Local Activities with TypeScript SDK

I have some workflows and activities that work perfectly fine.

I want to make the activities local activities (Activities | Temporal Documentation) to decrease load on the temporal cluster.

Looking through the docs, it seems I should be able to achieve this by replacing
const { f } = proxyActivities<typeof activities>(activityOptions);
with
const { f } = proxyLocalActivities<typeof activities>(activityOptions);

But when I trigger the new workflows, the worker fails and shuts down with this message:

Temporal worker error
Error: Expected timestamp, got null
    at tsToMs (/Users/richard.tweeddale/code/node_modules/@temporalio/common/src/time.ts:30:11)
    at extractActivityInfo (/Users/richard.tweeddale/code/node_modules/@temporalio/worker/src/worker.ts:1820:34)
    at async /Users/richard.tweeddale/code/node_modules/@temporalio/worker/src/worker.ts:849:34
    at async /Users/richard.tweeddale/code/node_modules/@temporalio/worker/src/tracing.ts:43:14
    at async /Users/richard.tweeddale/code/node_modules/@temporalio/worker/src/worker.ts:829:22

It works fine when I use proxyActivities instead of proxyLocalActivities.

Are there other steps needed to make activities into local activities?

That seems off.
Which SDK version are you using?
Can you provide a minimal reproduction?

@bergundy See related Slack discussion.

Hey @jwatkins or @bergundy we just hit this in our production Temporal worker ourselves. It seems to have been a one time thing and when we redeploy everything works as expected.

We are on 1.9.1 of the Typescript sdk. Do you have any updates, or suggestions for us? Doesn’t look like I have access to the Slack thread.

Slack history is only retained for 3 months unfortunately.

We had an issue where server version 1.23 did a big refactor to switch the protobuf library from gogo to the google one and during that refactor activity schedule to close timeout became nullable where previously it would default to the zero value.

This PR fixes the issue Ensure PollActivityTaskQueueResponse.ScheduleToCloseTimeout is not nil by bergundy · Pull Request #5444 · temporalio/temporal · GitHub.
If you’re a Temporal Cloud customer, this fix was already deployed shortly after we discovered the regression.

We’re also investigating how our feature test suite did not catch this earlier and we’ll make sure this type of regression never happens again.

1 Like