temporalio / temporalio/samples-typescript

[Bug] npx @temporalio/create@latest ./your-app fails to run

Open
#419 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
TypeScript
Stars
465
Forks
148
Avg merge
1d 10h
Merged PRs (30d)
11

Description

What are you really trying to do?

When following the instructions, npx @temporalio/create@latest ./your-app currently generates an app that won't run.

Describe the bug

Starting the dev server results in Error: Cannot find module 'ajv/dist/compile/codegen'.

Workaround fix is to npm i -D ajv

Full error log:

❯ npm run start.watch

> temporal-hello-world@0.1.0 start.watch
> nodemon src/worker.ts

[nodemon] 3.1.10
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): src/**/*
[nodemon] watching extensions: ts
[nodemon] starting `ts-node src/worker.ts`
2025-05-12T02:12:03.507Z [INFO] Creating worker {
  sdkComponent: 'worker',
  taskQueue: 'hello-world',
  options: {
    namespace: 'default',
    identity: '46856@Jasons-MBP-4.lan',
    useVersioning: false,
    buildId: undefined,
    shutdownGraceTime: 0,
    enableNonLocalActivities: true,
    maxConcurrentWorkflowTaskPolls: 10,
    maxConcurrentActivityTaskPolls: 10,
    stickyQueueScheduleToStartTimeout: '10s',
    maxHeartbeatThrottleInterval: '60s',
    defaultHeartbeatThrottleInterval: '30s',
    isolateExecutionTimeout: '5s',
    workflowThreadPoolSize: 1,
    maxCachedWorkflows: 2310,
    showStackTraceSources: false,
    debugMode: false,
    interceptors: { activity: [], workflowModules: [] },
    nonStickyToStickyPollRatio: 0.2,
    sinks: { __temporal_logger: [Object] },
    connection: NativeConnection {
      nativeClient: [External: 14315a3e0],
      referenceHolders: Set(0) {}
    },
    taskQueue: 'hello-world',
    workflowsPath: '/Users/blitz/github/jlengstorf/temporal-learning/src/workflows.ts',
    activities: Map(1) { 'greet' => [AsyncFunction: greet] },
    tuner: {
      workflowTaskSlotSupplier: [Object],
      activityTaskSlotSupplier: [Object],
      localActivityTaskSlotSupplier: [Object]
    },
    reuseV8Context: true,
    shutdownGraceTimeMs: 0,
    shutdownForceTimeMs: undefined,
    stickyQueueScheduleToStartTimeoutMs: 10000,
    isolateExecutionTimeoutMs: 5000,
    maxHeartbeatThrottleIntervalMs: 60000,
    defaultHeartbeatThrottleIntervalMs: 30000,
    loadedDataConverter: {
      payloadConverter: [DefaultPayloadConverter],
      failureConverter: [DefaultFailureConverter],
      payloadCodecs: []
    }
  }
}
2025-05-12T02:12:03.717Z [ERROR] asset workflow-bundle-ad2cf6a44ef5ba59b611.js 18.2 KiB [emitted] [immutable] (name: main)
runtime modules 937 bytes 4 modules
cacheable modules 818 bytes
  modules with errors 117 bytes [true errors]
    ./node_modules/@temporalio/workflow/lib/worker-interface.js 39 bytes [built] [code generated] [1 error]
    ./node_modules/@temporalio/workflow/lib/global-overrides.js 39 bytes [built] [code generated] [1 error]
    ./node_modules/@temporalio/workflow/lib/index.js 39 bytes [built] [code generated] [1 error]
  modules by path ./src/ 701 bytes
    ./src/workflows-autogenerated-entrypoint.cjs 451 bytes [built] [code generated]
    ./src/workflows.ts 250 bytes [built] [code generated]

ERROR in ./node_modules/@temporalio/workflow/lib/global-overrides.js
Module build failed (from ./node_modules/source-map-loader/dist/cjs.js):
Error: Cannot find module 'ajv/dist/compile/codegen'
Require stack:
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/ajv-keywords/dist/definitions/typeof.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/ajv-keywords/dist/keywords/typeof.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/ajv-keywords/dist/keywords/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/ajv-keywords/dist/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/schema-utils/dist/validate.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/schema-utils/dist/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/NormalModule.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/NormalModuleFactory.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/Compiler.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/webpack.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/@temporalio/worker/lib/workflow/bundler.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/@temporalio/worker/lib/worker.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/@temporalio/worker/lib/debug-replayer/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/@temporalio/worker/lib/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/src/worker.ts
    at Function.<anonymous> (node:internal/modules/cjs/loader:1405:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/Users/blitz/github/jlengstorf/temporal-learning/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1061:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1066:22)
    at Function._load (node:internal/modules/cjs/loader:1215:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1491:12)
    at require (node:internal/modules/helpers:135:16)
    at Object.<anonymous> (/Users/blitz/github/jlengstorf/temporal-learning/node_modules/ajv-keywords/src/definitions/typeof.ts:2:1)
 @ ./src/workflows-autogenerated-entrypoint.cjs 5:28-83

ERROR in ./node_modules/@temporalio/workflow/lib/index.js
Module build failed (from ./node_modules/source-map-loader/dist/cjs.js):
Error: Cannot find module 'ajv/dist/compile/codegen'
Require stack:
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/ajv-keywords/dist/definitions/typeof.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/ajv-keywords/dist/keywords/typeof.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/ajv-keywords/dist/keywords/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/ajv-keywords/dist/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/schema-utils/dist/validate.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/schema-utils/dist/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/NormalModule.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/NormalModuleFactory.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/Compiler.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/webpack.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/@temporalio/worker/lib/workflow/bundler.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/@temporalio/worker/lib/worker.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/@temporalio/worker/lib/debug-replayer/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/@temporalio/worker/lib/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/src/worker.ts
    at Function.<anonymous> (node:internal/modules/cjs/loader:1405:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/Users/blitz/github/jlengstorf/temporal-learning/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1061:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1066:22)
    at Function._load (node:internal/modules/cjs/loader:1215:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1491:12)
    at require (node:internal/modules/helpers:135:16)
    at Object.<anonymous> (/Users/blitz/github/jlengstorf/temporal-learning/node_modules/ajv-keywords/src/definitions/typeof.ts:2:1)
 @ ./src/workflows.ts 1:0-55 2:18-33
 @ ./src/workflows-autogenerated-entrypoint.cjs 9:9-112

ERROR in ./node_modules/@temporalio/workflow/lib/worker-interface.js
Module build failed (from ./node_modules/source-map-loader/dist/cjs.js):
Error: Cannot find module 'ajv/dist/compile/codegen'
Require stack:
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/ajv-keywords/dist/definitions/typeof.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/ajv-keywords/dist/keywords/typeof.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/ajv-keywords/dist/keywords/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/ajv-keywords/dist/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/schema-utils/dist/validate.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/schema-utils/dist/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/NormalModule.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/NormalModuleFactory.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/Compiler.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/webpack.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/@temporalio/worker/lib/workflow/bundler.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/@temporalio/worker/lib/worker.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/@temporalio/worker/lib/debug-replayer/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/node_modules/@temporalio/worker/lib/index.js
- /Users/blitz/github/jlengstorf/temporal-learning/src/worker.ts
    at Function.<anonymous> (node:internal/modules/cjs/loader:1405:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/Users/blitz/github/jlengstorf/temporal-learning/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1061:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1066:22)
    at Function._load (node:internal/modules/cjs/loader:1215:37)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:235:24)
    at Module.require (node:internal/modules/cjs/loader:1491:12)
    at require (node:internal/modules/helpers:135:16)
    at Object.<anonymous> (/Users/blitz/github/jlengstorf/temporal-learning/node_modules/ajv-keywords/src/definitions/typeof.ts:2:1)
 @ ./src/workflows-autogenerated-entrypoint.cjs 2:12-67

webpack 5.99.8 compiled with 3 errors in 87 ms { sdkComponent: 'worker', taskQueue: 'hello-world' }
Error: Webpack finished with errors, if you're unsure what went wrong, visit our troubleshooting page at https://docs.temporal.io/develop/typescript/debugging#webpack-errors
    at /Users/blitz/github/jlengstorf/temporal-learning/node_modules/@temporalio/worker/src/workflow/bundler.ts:273:17
    at finalCallback (/Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/Compiler.js:496:32)
    at /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/Compiler.js:574:17
    at /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/HookWebpackError.js:67:2
    at Hook.eval [as callAsync] (eval at create (/Users/blitz/github/jlengstorf/temporal-learning/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/blitz/github/jlengstorf/temporal-learning/node_modules/tapable/lib/Hook.js:18:14)
    at Cache.storeBuildDependencies (/Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/Cache.js:128:37)
    at /Users/blitz/github/jlengstorf/temporal-learning/node_modules/webpack/lib/Compiler.js:570:19
    at Hook.eval [as callAsync] (eval at create (/Users/blitz/github/jlengstorf/temporal-learning/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
    at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/Users/blitz/github/jlengstorf/temporal-learning/node_modules/tapable/lib/Hook.js:18:14)
[nodemon] app crashed - waiting for file changes before starting...
Minimal Reproduction

Create a new TypeScript project:

npx @temporalio/create@latest ./your-app

Then attempt to run it:

npm run start.watch

Errors will appear.

Environment/Versions
  • OS and processor: M1 Mac
  • Temporal Version: CLI 1.3.0 (Server 1.27.1, UI 2.36.0), @temporalio/worker@^1.11.6
  • Are you using Docker or Kubernetes or building Temporal from source? no
Additional context

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the failure by running npx @temporalio/create@latest ./your-app, then npm run start.watch in the generated project. Start at src/worker.ts and src/workflows.ts, following the reported Webpack dependency error. Done means the generated app starts without requiring the manual npm i -D ajv workaround.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript, webpack
Domain
backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.