Skip to content

Bug: idempotency e2e durable-function tests fail at init on @aws/durable-execution-sdk-js@1.1.3 #5280

@svozza

Description

@svozza

Expected Behavior

The idempotency e2e durable-function tests deploy a Lambda whose handler imports withDurableExecution from @aws/durable-execution-sdk-js. With @aws/durable-execution-sdk-js@1.1.2, the function initialises successfully and the suite (packages/idempotency/tests/e2e/durableIdempotent.test.ts) passes on both nodejs22x and nodejs24x.

Current Behavior

After the dev dependency was bumped to ^1.1.3 in commit cf85f673, the test Lambda fails at init with:

TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string or an instance of URL. Received undefined
    at Object.fileURLToPath (node:internal/url:1606:11)
    at Object.<anonymous> (/var/task/index.js:1:931)

The error fires during platform.initStart and the function never completes initialisation, so every invocation in the suite returns Runtime.Unknown. The same handler bundled against 1.1.2 initialises cleanly. There is a related upstream change in flight at aws/aws-durable-execution-sdk-js#546 that we plan to pick up once it is released.

Code snippet

// packages/idempotency/tests/e2e/durableIdempotent.FunctionCode.ts
import {
  type DurableContext,
  withDurableExecution,
} from '@aws/durable-execution-sdk-js';
import { makeIdempotent } from '../../src/makeIdempotent.js';
import { DynamoDBPersistenceLayer } from '../../src/persistence/DynamoDBPersistenceLayer.js';

const dynamoDBPersistenceLayer = new DynamoDBPersistenceLayer({
  tableName: process.env.IDEMPOTENCY_TABLE_NAME ?? 'table_name',
});

export const handlerDurable = withDurableExecution(
  makeIdempotent(
    async (event: { foo: string }, context: DurableContext) => {
      await context.wait({ seconds: 1 });
      return event.foo;
    },
    { persistenceStore: dynamoDBPersistenceLayer }
  )
);

The handler is bundled by aws-cdk-lib/aws-lambda-nodejs NodejsFunction via our test helper packages/testing/src/resources/TestNodejsFunction.ts, which defaults to OutputFormat.CJS with minify: true.

Steps to Reproduce

  1. Check out main (currently has "@aws/durable-execution-sdk-js": "^1.1.3" in packages/idempotency/package.json).
  2. npm install from the repo root (lockfile resolves to 1.1.3).
  3. From packages/idempotency, deploy and invoke the durable suite, e.g. RUNTIME=nodejs24x npm run test:e2e -- durableIdempotent.
  4. The deployed function fails on cold start; CloudWatch shows the fileURLToPath TypeError above and platform.initRuntimeDone reports status:"error", errorType:"Runtime.Unknown".

Reverting the dev dependency to an exact 1.1.2 and re-running the same flow makes the suite pass.

Possible Solution

Short term: pin packages/idempotency dev dependency to the exact version "@aws/durable-execution-sdk-js": "1.1.2" (no caret, so the range does not re-resolve forward to 1.1.3) and refresh package-lock.json. Re-bump to a caret range once aws/aws-durable-execution-sdk-js#546 ships in a published release.

Powertools for AWS Lambda (TypeScript) version

latest (currently 2.33.0)

AWS Lambda function runtime

24.x (the same failure is also observed on 22.x)

Packaging format used

npm

Execution logs

{"time":"2026-05-21T14:08:35.511Z","type":"platform.initStart","record":{
  "initializationType":"on-demand","phase":"invoke",
  "runtimeVersion":"nodejs:24.DurableFunction.v16",
  "functionName":"Idempotency-24-x86-XXXXX-durable-durableFn",...}}

{"timestamp":"2026-05-21T14:08:35.711Z","level":"ERROR","message":{
  "errorType":"TypeError",
  "errorMessage":"The \"path\" argument must be of type string or an instance of URL. Received undefined",
  "stackTrace":[
    "TypeError [ERR_INVALID_ARG_TYPE]: The \"path\" argument must be of type string or an instance of URL. Received undefined",
    " at Object.fileURLToPath (node:internal/url:1606:11)",
    " at Object.<anonymous> (/var/task/index.js:1:931)",
    " at Module._compile (node:internal/modules/cjs/loader:1812:14)",
    ...
  ],
  "code":"ERR_INVALID_ARG_TYPE"}}

{"time":"2026-05-21T14:08:35.729Z","type":"platform.initRuntimeDone","record":{
  "initializationType":"on-demand","phase":"invoke",
  "status":"error","errorType":"Runtime.Unknown"}}

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriageThis item has not been triaged by a maintainer, please wait

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    Coming soon

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions