Skip to content

fix(workflow-engine-redis): support top-level module options in loader - #16740

Open
Tyagiquamar wants to merge 1 commit into
medusajs:developfrom
Tyagiquamar:fix/workflow-engine-redis-options
Open

fix(workflow-engine-redis): support top-level module options in loader#16740
Tyagiquamar wants to merge 1 commit into
medusajs:developfrom
Tyagiquamar:fix/workflow-engine-redis-options

Conversation

@Tyagiquamar

@Tyagiquamar Tyagiquamar commented Sep 6, 2026

Copy link
Copy Markdown

What

This PR updates the Redis Workflow Engine module loader (packages/modules/workflow-engine-redis/src/loaders/redis.ts) to read options from top-level module configuration (options) in addition to the legacy nested options.redis object. It also adds an optional redis?: RedisWorkflowsOptions field to RedisWorkflowsOptions for full backwards compatibility.

Why

Closes #16697.
Module options declared via declare module "@medusajs/types" define top-level configuration options (e.g. options: { redisUrl: "...", queueOptions: { ... } }), matching the module options pattern used across other infrastructure modules (such as @medusajs/event-bus-redis and @medusajs/cache-redis).

Previously, the runtime loader only destructured options?.redis, causing top-level options to be ignored and throwing an error indicating that no redisUrl was provided even when properly configured according to the TypeScript types.

How

  1. In packages/modules/workflow-engine-redis/src/loaders/redis.ts, resolve redisConfig as options?.redis ?? options ?? {}.
  2. Update the missing URL error message to accurately reflect modern and legacy option names: No \redisUrl` (or deprecated `redis.redisUrl` / `url`) provided in `workflowOrchestrator` module options.`.
  3. Added redis?: RedisWorkflowsOptions in types/index.ts so legacy nested configurations remain type-safe.
  4. Added test cases in redis.spec.ts covering top-level configuration, per-queue overrides, and missing-URL validation.
  5. Added changeset for @medusajs/workflow-engine-redis.

Testing

  • Added unit tests in packages/modules/workflow-engine-redis/src/loaders/__tests__/redis.spec.ts verifying:
    • Top-level redisUrl and shared queue/worker options resolution
    • Top-level custom queue names
    • Nested options backwards compatibility
    • Missing URL error assertions for both top-level and nested configs
  • Ran unit test suite locally; all tests passing green.

@Tyagiquamar
Tyagiquamar requested a review from a team as a code owner September 6, 2026 12:13
@changeset-bot

changeset-bot Bot commented Sep 6, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 8fca432

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 83 packages
Name Type
@medusajs/workflow-engine-redis Patch
@medusajs/medusa Patch
@medusajs/test-utils Patch
@medusajs/loyalty-plugin Patch
@medusajs/medusa-oas-cli Patch
integration-tests-http Patch
@medusajs/analytics Patch
@medusajs/api-key Patch
@medusajs/auth Patch
@medusajs/caching Patch
@medusajs/cart Patch
@medusajs/currency Patch
@medusajs/customer Patch
@medusajs/file Patch
@medusajs/fulfillment Patch
@medusajs/index Patch
@medusajs/inventory Patch
@medusajs/link-modules Patch
@medusajs/locking Patch
@medusajs/notification Patch
@medusajs/order Patch
@medusajs/payment Patch
@medusajs/pricing Patch
@medusajs/product Patch
@medusajs/promotion Patch
@medusajs/rbac Patch
@medusajs/region Patch
@medusajs/sales-channel Patch
@medusajs/search Patch
@medusajs/settings Patch
@medusajs/stock-location Patch
@medusajs/store Patch
@medusajs/tax Patch
@medusajs/translation Patch
@medusajs/user Patch
@medusajs/workflow-engine-inmemory Patch
@medusajs/search-postgres Patch
@medusajs/draft-order Patch
@medusajs/oas-github-ci Patch
@medusajs/cache-inmemory Patch
@medusajs/cache-redis Patch
@medusajs/event-bus-local Patch
@medusajs/event-bus-redis Patch
@medusajs/analytics-local Patch
@medusajs/analytics-posthog Patch
@medusajs/auth-emailpass Patch
@medusajs/auth-github Patch
@medusajs/auth-google Patch
@medusajs/auth-oidc Patch
@medusajs/caching-redis Patch
@medusajs/file-local Patch
@medusajs/file-s3 Patch
@medusajs/fulfillment-manual Patch
@medusajs/locking-postgres Patch
@medusajs/locking-redis Patch
@medusajs/notification-local Patch
@medusajs/notification-sendgrid Patch
@medusajs/payment-stripe Patch
@medusajs/core-flows Patch
@medusajs/framework Patch
@medusajs/instantsearch-adapter Patch
@medusajs/js-sdk Patch
@medusajs/modules-sdk Patch
@medusajs/orchestration Patch
@medusajs/query Patch
@medusajs/types Patch
@medusajs/utils Patch
@medusajs/workflows-sdk Patch
create-medusa-app Patch
@medusajs/http-types-generator Patch
@medusajs/cli Patch
@medusajs/deps Patch
@medusajs/eslint-plugin Patch
@medusajs/telemetry Patch
@medusajs/admin-bundler Patch
@medusajs/admin-sdk Patch
@medusajs/admin-shared Patch
@medusajs/admin-vite-plugin Patch
@medusajs/dashboard Patch
@medusajs/icons Patch
@medusajs/toolbox Patch
@medusajs/ui-preset Patch
@medusajs/ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@medusa-os-bot

medusa-os-bot Bot commented Sep 6, 2026

Copy link
Copy Markdown

Thanks for the contribution! Initial automated review looks good.

The author fixes a mismatch between the TypeScript module-options type (RedisWorkflowsOptions, which declares top-level fields like redisUrl) and the runtime loader (which only read from the nested options.redis object). The fix adds a one-line fallback: redisConfig = options?.redis ?? options ?? {}. Nested config continues to take priority for backward compatibility; top-level config now works as well. A redis?: RedisWorkflowsOptions field is added to the type to make the legacy nested format type-safe. The error message is updated to reflect both paths, and unit tests cover top-level config, shared queue/worker options, per-queue overrides, and missing-URL errors for both config shapes. PR template is complete, the issue is verified and open, a correctly-formatted patch changeset is included, and no security, performance, or correctness issues were found. Heads up: PR #16698 (opened 2026-09-02) also references issue #16697 and was opened earlier; if #16698 (or #16699, #16730, #16736) is merged first, this PR may be closed as a duplicate.

Triggered by: new PR opened

@Tyagiquamar

Copy link
Copy Markdown
Author

Hi, friendly ping for review on this PR when you have a moment. Happy to address any feedback. Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: [workflow-engine-redis] Options type declares top-level redisUrl but loader only reads nested options.redis

1 participant