- Newest
- Most votes
- Most comments
You're right about the import issue with the AWS Lambda durable functions example. The error occurs because the import statement in the example is not correctly accessing the exports from the @aws/durable-execution-sdk-js module.
The fix you've provided is correct. Instead of using named imports directly, you can use the following approach:
import * as durableSDK from '@aws/durable-execution-sdk-js'; const { withDurableExecution, DurableContext } = durableSDK; export const handler = withDurableExecution( async (event: any, context: DurableContext) => { const result = await context.step(async () => { return "step completed"; }); return result; }, );
This approach first imports the entire module as durableSDK and then extracts the specific functions and types you need. This works because it properly accesses the exports provided by the durable execution SDK.
Alternatively, you could also check the module's actual export structure and adjust your imports accordingly, as the SDK's export interface might have changed since the documentation was written.
Sources
Basic concepts - AWS Lambda
answered 10 months ago
Relevant content
asked 4 years ago
- AWS OFFICIALUpdated 9 months ago
- AWS OFFICIALUpdated 5 months ago

Please then also fix the official AWS documentation here https://docs.aws.amazon.com/lambda/latest/dg/durable-basic-concepts.html