Get the no.of retries done till now for an activity inside the activity code

is there any way to get the retry attempt number inside the activity code, using typeScript sdk?

Yes, use the following code:

import * as activity from '@temporalio/activity';

async function myActivity() {
  const { attempt } = activity.Context.current().info;

See also the API reference here: Interface: Info | Temporal TypeScript SDK API Reference

1 Like

Hey Thanks a Lot!!, This worked.