Skip to content

Releases: medusajs/medusa

v1.20.6

02 May 15:53
Compare
Choose a tag to compare

Highlights

Resolves several issues in @medusajs/admin

  • Add default value for host option in @medusjs/admin.
  • Updates the version of tailwindcss, autoprefixer, and postcss in @medusajs/admin-ui, to avoid issues when importing components using tailwindcss@4.
  • Fixes an issue in @medusajs/medusa where the develop command would throw an error when @medusajs/admin was not installed.

#7203

Bugs

Full Changelog: v1.20.5...v1.20.6

v1.20.5

01 May 08:36
Compare
Choose a tag to compare

Highlights

Preview release of Medusa 2.0 next week

We recently announced Medusa 2.0, and the majority of our time and resources are currently going into making this new major a reality as soon as possible. We will reach an important milestone next week by releasing an early preview version for experimentation and exploration. More information about the preview version will be shared alongside the release.


Remove useToast hook from @medusajs/ui

🚧 Breaking change

The useToast hook has been removed. Users should instead use the toast function that is exported from the @medusajs/ui package. This function can be used to show toasts in your application. For more information on how to use the toast function, please refer to the documentation.

The Toaster component is still available but the options for the component have changed. The default position has been changed to bottom-right. For more information on the Toaster component, please refer to the documentation.

Order totals account for deleted discounts

An issue with order totals not accounting for deleted discounts has been resolved.

#6837

Resolve node-gyp installation issue in @medusajs/admin

An issue with node-gyp in a dependency of a dependency has been resolved. The solution should, for the time being, be considered temporary.

#6952

Expose backend URL for admin in local development

The forced backend URL for admin in local development has been removed in favor of a plugin configuration.

You can now specify a host value:

// medusa-config.js
const plugins = [
  ...
  {
    resolve: "@medusajs/admin",
    options: {
      // other options...
      develop: {
        port: 7000,
        host: "example.com",
      },
    },
  },
]

#7128

Features

Read more

v1.20.4

26 Mar 17:46
2524a9d
Compare
Choose a tag to compare

Highlights

Introducing Worker Mode

This release ships Worker Mode, a new runtime mode for Medusa instances.

Worker Mode allows you to start a Medusa instance in a process separate from the main application process. An instance running in Worker Mode is useful for executing long-running or resource-heavy tasks in the background. Those tasks are offloaded to a separate process and will not affect the performance of the main application. Examples of tasks are importing data or updating a search index. While Worker Mode is especially good for resource-intensive tasks, we recommend always starting an instance in this mode if possible.

Worker Mode introduces three new runtime modes for your Medusa instance:

  • server: API Routes are registered, and no workers are started.
  • worker: API Routes are not registered, and workers are started.
  • shared: API routes are registered, and workers are started (the regular runtime mode + default).

The worker mode is configured in medusa-config.js:

// medusa-config.js
const projectConfig = {
  ...,
  database_url: "...",
  worker_mode: "worker",
};

In this release, the Redis Event Bus has been updated to leverage the worker architecture. Instantiating a Medusa instance with worker_mode: "server" and a different one with worker_mode: "worker" will separate background job processing from the public-facing main application, given that the Redis Event Bus module is installed.

Features

Bugs

Chores

  • chore: Deprecate extra in favor of driver options by @adrien2p in #6772
  • chore: merge money amounts and price set money amounts by @riqwan in #6768
  • chore: pricing models uses standardized relationships attributes by @riqwan in #6767
  • chore: update naming in abstract service to dto specifics by @riqwan in #6763
  • chore: add TSDocs to the API Key Module by @shahednasser in #6785
  • chore(docs): Updated UI Reference by @github-actions in #6754

Documentation

New Contributors

Full Changelog: v1.20.3...v1.20.4

v1.20.3

20 Mar 11:25
a859b78
Compare
Choose a tag to compare

Highlights

Medusa 2.0 update

Most of the changes in this release are related to Medusa 2.0 and will not affect any users' setup. The expected date for a 2.0 release candidate is early summer. You can track the progress in our high-level roadmap.

The larger remaining todos are:

  • Convert Rest API to use Workflows, new modules, and API routes
  • Migrate Admin to use 2.0
  • Documentation
  • Migration guide
  • Cleanup/housekeeping

Admin Redesign update

Aside from changes for Medusa 2.0, this release also contains work for the Admin Redesign, set to be released in beta at the beginning of April. The redesign will significantly improve the UX and UI of our admin dashboard and make the overall look and feel much more consistent.

Others

Additionally, this release squashes some minor bugs in Medusa 1.*.

Make medusaClient optional in MedusaProvider

The property medusaClient on the type MedusaProviderProps in medusa-react has been updated to be optional.

Using the MedusaProvider without the medusaClient will initialize and use a new default client under the hood:

<MedusaProvider
  baseUrl={process.env.MEDUSA_BASE_URL}
  ...
>
    {children}
</MedusaProvider>

#6363

Add Product Categories to search subscriber

Product categories are included in search indexing on product updates and creations if the product categories feature flag is enabled.

#6555

Update index on customer table

The multicolumn uniqueness index on the customer table (email, has_account) has been updated to only apply to rows where deleted_at is null. This is to allow for the creation of customers that were previously soft-deleted.

#6631

Features

Read more

v1.20.2

08 Feb 15:46
Compare
Choose a tag to compare

Highlights

Improve error messaging

We have improved error messaging for missing exports of custom services. Until now, the following non-descriptive message was logged:

image

In 1.20.2, the same error will now log to the console:

CleanShot 2024-02-08 at 10 11 16

This change landed in #6240.

Expose option to configure batch size of staged job polling

We have introduced an option jobs_batch_size in the projectConfig in medusa-config.js, allowing users to configure the batch size of staged jobs we poll from the database every 3rd second. By default, we poll 1000 jobs, which has proven to cause issues with some setups. This option aims to resolve those.

Example config:

   module.exports = {
      projectConfig: {
       jobs_batch_size: 10 // poll 10 jobs every 3rd second
     },
   }

This change landed in #6333.

Support order by queries on GET /admin/orders

We have introduced an order query param on the GET /admin/orders endpoint to support ordering orders.

This change landed in #6258.

Admin revamp (status)

Our work on the admin revamp is progressing well. Below is an overview of completed and remaining work:

Completed

  • Customers domain
  • Customer Groups domain
  • Taxes domain
  • Currencies domain
  • Regions domain
  • Stores domain
  • Sales Channels domain
  • Users domain
  • API keys domain

Remaining

  • Orders domain
  • Draft Orders domain
  • Products domain
  • Gift Cards domain
  • Categories domain
  • Inventory domain
  • Discounts domain
  • Regions domain
  • Taxes domain
  • Locations domain

Medusa 2.0 (status)

We spend most of our time working on Medusa 2.0 and are seeing great improvements weekly.

You can follow our development in our roadmap.

Here's a high-level overview of completed, WIP, and planned work:

Completed

  • Pricing Module
  • Product Module
  • Sales Channel Module
  • Customer Module
  • Workflows / long-running workflows

Work-in-progress

  • Payment Module
  • Cart Module
  • Regions Module
  • Fulfillment Module
  • Regions Module
  • Promotions Module
  • Authentication Module
  • User Module
  • Linked Modules
  • Admin: Workflows UI
  • Admin: Vite build-tooling
  • Admin: UI + UX revamp
  • Index Engine
  • Rest API V2 (using workflows)

Planned (non-exhaustive)

  • API keys Module
  • Taxes Module
  • Store Module
  • Notification Module
  • Order Module

Features

Bugs

Documentation

Chores

New Contributors

Full Changelog: v1.20.1...v1.20.2

v1.20.1

25 Jan 15:39
Compare
Choose a tag to compare

Highlights

Segment plugin update: Typescript support and Subscribers API

Landed in #5904.

SendGrid plugin update: Custom templates support

Landed in #5833.

Axios adapter support in @medusajs/medusa-js

Landed in #6214.

Improved deployment guides

Landed in #6183.

API Routes for Medusa v2

Core API Routes (located in packages/medusa/src/api) are not registered when Medusa v2 feature flag is enabled.

And to repeat, all changes behind Medusa v2 are very unstable, highly experimental, and a work in progress at this point, so we do not encourage the use of the feature flag yet.

Follow our development toward Medusa v2 in our roadmap.

Features

Bugs

Chores

Documentation

New Contributors

Full Changelog: v1.20.0...v1.21.0

v1.20.0

09 Jan 18:05
Compare
Choose a tag to compare

Highlights

Improved Stripe plugin architecture + webhook

🚧 Breaking change in medusa-plugin-stripe

Two important changes have been introduced to the Stripe plugin, one of which is breaking.

The endpoints and subscribers in the plugin have been migrated to use our new API Routes and Subscribers. This significantly lowers the code footprint of the package and makes it easier to maintain.

The webhook event management has changed significantly from in-band processing of the event to now using our Event Bus to process it as a background job. There were several motivations for this change: 1) it is deemed best practice to respond with a 200 immediately upon receiving a webhook request, 2) it allows for our retry mechanism to kick in in case the processing fails, and 3) it gives us more control of how the event is processed.

One example of the latter, effective from this release, is that we've added a 5s delay on processing events to avoid conflicts stemming from race conditions between the webhook and client requests.

Changed service checks from an instance of to a static property check

🚧 Breaking change

Several issues have been filed related to failing registrations of different types of services, such as payment providers, fulfillment providers, and similar. The culprit to these issues was found in how we check the type of the service class.

Until now, we've relied on instance of to perform the check:

export function isPaymentProcessor(obj: unknown): boolean {
  return obj instanceof AbstractPaymentProcessor
}

However, if you have a version mismatch in your packages, the instance of check will fail even though the services are seemingly the expected type.

With this release, the service class type checks are now performed with static properties to eliminate this issue:

static isPaymentProcessor(object): boolean {
    return object?.constructor?._isPaymentProcessor
}

More robust and reliable cart completion

🚧 Important change

Our cart completion API has been updated to increase robustness and reliability - especially under high load. The update includes removing serializable transactions from the API and generally refactoring our transaction management.

As a positive side effect, the changes have also made for a more performant API.

Database schema changes

Minor changes to the schema of table publishable_api_key_sales_channel have been introduced.

Please, apply the new migration by running the following command in your Medusa project after having updated:

npx @medusajs/medusa-cli migrations run

order by queries on deeply nested relations

An issue with duplicated rows in the result set in order by queries on deeply nested relations has been resolved.

Read more about the change in the PR description.

API reference for medusa-react

An API reference and examples for our medusa-react library have been introduced to our documentation.

Admin translations

With this release, the following languages are supported in Medusa Admin: Simplified Chinese, Bulgarian, Slovenian, Czech, and Japanese.

Features

  • feat(medusa): add currency to region responses by @riqwan in #5857
  • feat(medusa): Update shipping option price type by @pKorsholm in #5895
  • feat(medusa, link-modules): sales channel <> product module link by @fPolic in #5450
  • feat(admin): Added Simplified Chinese support by @chrislaai in #5798
  • feat(admin): Bulgarian language support by @edisaso in #5786
  • feat(medusa): Slovenian(sl) translation by @glomon in #5828
  • feat(workflows-sdk): Configurable retries upon step creation by @adrien2p in #5728
  • feat(medusa): Prevent cart completion conflict by @adrien2p in #5814
  • feat(admin): Add Czech language support by @hexrw in #5822
  • feat(admin): Add Japanese language support by @hmmhmmhm in #5795
  • feat(medusa-payment-stripe): Add delay to Stripe webhook by @olivermrbl in #5838
  • feat(orchestration, workflows-sdk): Add events management and implementation to manage async workflows by @adrien2p in #5951
  • feat(medusa, link-modules): sales channel <> pubkey link by @fPolic in #5820
  • feat(pricing, types, utils): Soft delete pricing entities by @pKorsholm in #5858
  • feat(medusa, link-modules): sales channel <> order link by @fPolic in #5810
  • feat(types,utils): added promotion create with rules and application target rules by @riqwan in #5957
  • feat(cart): Add cart module package by @olivermrbl in #5982
  • Feat(medusa-test-utils, utils, pricing, product, link-modules): upgrade mikro orm version to latest by @pKorsholm in #5985
  • feat(medusa, link-modules): sales channel <> cart link by @fPolic in #5459
  • feat(workflows-sdk): Allow primitive values to be passed as well as WorkflowDataProperties by @adrien2p in #5953
  • feat(types,utils): add promotions create with application method by @riqwan in #5945
  • feat(workflows-sdk): Allow a step to not define an expected input by @adrien2p in #5775
  • feat(types,modules-sdk): basic module setup for promotions by @riqwan in #5920
  • feat(types,module-sdk): setup authentication module skeleton by @pKorsholm in #5943
  • feat(types): promotion delete / update / retrieve / add/remove-rules by @riqwan in #5988
  • feat(cart): Data models by @olivermrbl in #5986
  • feat(admin): Add Libya admin region and set Libya to formal name by @abusaidm in #6001
  • feat(authentication): Load auth providers by @pKorsholm in #6023

Bugs

  • fix: redis_options for job scheduler by @kstoklosa in #5894
  • fix(medusa): Passport loader resolving to early by @adrien2p in #5901
  • fix: Typo in documentation by @aldo-roman in #5933
  • fix(medusa, medusa-js): publishable api key bugs by @olivermrbl in #5926
  • fix(medusa, pricing, types): pass dates as Date-objects rather than strings to the pricing module by @pKorsholm in #5768
  • fix(utils): More resilient object from string path by @adrien2p in #5929
  • fix(medusa-js): remove unnecessary query field in AdminInventoryItemsResource.deleteLocationLevel method by @shahednasser in #5941
  • fix(medusa): add payments default relation to getTotalsRelations by @cyf0e in #5875
  • fix(medusa): Resolve babel executable with npx by @olivermrbl in #5952
  • fix(medusa): Update cart sales channel should not remove all line items by @adrien2p in #5980
  • fix(medusa-payment-stripe): fix error handling by @adrien2p in #5991
  • fix(medusa): cart completion payment sessions by @adrien2p in #5995
  • fix(medusa): Ordering management using joins and pagination by @adrien2p in #5990
  • fix(medusa): Fix typo in discounts error message by @Sajarin-M in #5853
  • fix(medusa-payment-stripe): change webhook environment variables to plugin options by@shahednasser in #6034

Chores

Documentation

Read more

v1.19.0

14 Dec 14:49
Compare
Choose a tag to compare

Highlights

Cart-completion strategy response

🚧 Breaking change

Attempting to complete an already completed cart will no longer return a 409 conflict. Instead, the order or swap associated with the completed cart is returned.

More specifically, the response will take one of the following two shapes:

// completing a regular cart
{
  response_code: 200,
  response_body: { data: order, type: "order" },
}

// completing a swap cart
{
  response_code: 200,
  response_body: { data: swap, type: "swap" },
}

node-redis replaced with ioredis for session management

🚧 Important change

Our default Express session store has been changed from node-redis to ioredis.

This was done in response to a request for higher configurability of the Redis client used for session management. It was decided to not only expose more options but simultaneously change the library to ioredis to be consistent with other packages that use Redis, e.g. the Redis Event Bus + Redis Cache.

Add to cart performance improvements

The add-to-cart endpoint, POST /store/carts/:id/line-items, has been refactored, improving performance and transaction management. The latter was done in response to some users experiencing issues with concurrent requests leading to database conflicts. The changes to transaction management in the endpoint should significantly reduce the risk of this issue occurring while improving performance.

Some rough benchmarks show that for 1000 requests (10-20/s), we see approx. 30% of requests fail due to database conflicts in the latest version. With this PR, 0% of requests fail – even under a higher load.

New cluster command added to @medusajs/medusa-cli

A new cluster command has been added to our CLI, @medusajs/medusa-cli:

medusa start-cluster --cpus 3 

The command allows you to start Medusa in cluster mode. By default, cluster mode will try to consume all available CPUs for Medusa instances. You can specify the number of CPUs with a CLI argument --cpus.

Running in cluster mode will likely significantly improve performance as the workload and tasks are distributed among all available instances instead of a single one.

Retry support in medusa-react

🚧 Important change

You can now specify maxRetries as a prop to the MedusaProvider from medusa-react. This config is passed on to the underlying medusa-js client, which means failed requests are retried the amount of times specified by the param. If not provided, the maxRetries defaults to 3.

import { MedusaProvider as Provider } from "medusa-react"
import { queryClient } from "../constants/query-client"

export const MedusaProvider = ({ children }) => {
  return (
    <Provider
      queryClientProviderProps={{
        client: queryClient,
      }}
      baseUrl={process.env.MEDUSA_BACKEND_URL}
      maxRetries={2}
    >
      {children}
    </Provider>
  )
}

Features

  • feat(link-modules, pricing, product, utils): Should be able to set some custom database config even in shared mode by @adrien2p in #5755
  • feat(medusa): Respond with order when cart is already completed by @olivermrbl in #5766
  • feat(medusa-cli): add monorepo support command develop by @driver005 in #5723
  • feat(admin): Add Korean language support by @iweurman in #5769
  • feat(medusa-payment-klarna): Add language variable by @edinskeja in #4483
  • feat(medusa): Improve add line item to cart perf and transaction management + clustering start command by @adrien2p in #5701
  • feat(medusa): Replace Node Redis with ioredis by @pepijn-vanvlaanderen in #5656
  • feat(core-flows,pricing,medusa,pricing,types,utils): Price List Prices can have their own rules by @riqwan in #5752
  • feat(medusa): Emit "discount.created" event when discount is created by @Arsenalist in #5816
  • feat(orchestration,core-flows,medusa,product,types,utils): product import/export uses workflows by @riqwan in #5811
  • feat(medusa, core-workflows, product): slightly improve create cart workflow by @adrien2p in #5725
  • feat(admin-ui): metadata for categories in admin ui and refactor to react-hook-form by @luluhoc in #5697

Bugs

Docs

Chores

  • chore(): Add engines to all package.json if needed by @adrien2p in #5812
  • chore(medusa): Prefer logger instead of console.log by @adrien2p in #5846

New Contributors

Full Changelog: v1.18.1...v1.19.0

v1.18.1

27 Nov 17:08
cdc1da5
Compare
Choose a tag to compare

Highlights

Workflows (beta)

This release introduces Workflows to Medusa's toolbox for creating digital commerce applications.

Our new Workflows tooling is published under @medusajs/workflows-sdk.

Workflows is in beta. Please help us improve the product and squash bugs by filing issues for the errors you encounter.

A workflow is a series of queries and actions that complete a task. You can think of Medusa as being made up of many workflows. For example, when adding line items to carts, we perform several actions:

  1. Get the product’s title
  2. Calculate the price of the product
  3. Create a line item
  4. Add the line item to a cart

All these actions are steps in a workflow.

Workflows can also be more advanced - like managing a return or processing an inbound purchase order.

You can explore and try our new Workflow tooling in our documentation.

Read more about Workflows on our blog.

Pricing Module

This release marks the completion of the first iteration of our Pricing Module - a standalone pricing service that enables granular pricing configurations.

The Pricing Module is published under @medusajs/pricing.

You can use the Pricing Module separately from Medusa to enable advanced pricing logic for any resource specific to your needs.

The module is integrated into our core @medusajs/medusa behind the feature flag medusa_v2. All features behind this flag are deemed highly experimental as we move toward Medusa 2.0, so please use it with caution.

The feature flag medusa_v2 is not stable for production environments.

Read more about the Pricing Module and our plans for Medusa 2.0.

Product Variant pricing updates

The introduction of the Bulk Editor made it easy to update product variant prices.

With this release, we are centralizing product variant pricing in the Bulk Editor and removing all other entry points for operations related to pricing.

As a result, you can no longer modify prices of product variants in the following flows:

  • Creating a product
  • Adding a variant to a product
  • Editing a variant of a product

You should use the "Edit Prices" option in the dropdown of the variants section:

CleanShot 2023-11-26 at 17 46 47@2x

Features

Bugs

  • fix(pricing,types): remove is_dynamic from model + types by @riqwan in #5664
  • fix(workflows): compensation handling by @adrien2p in #5691
  • fix(ui): code block styles in @kasperkristensen in #5692
  • fix(product, types, workflows): Update product variant workflow by @pKorsholm in #5668
  • fix(medusa): Normalize subscriber paths by @kasperkristensen in #5703
  • fix(pricing, medusa): resolve minor pricing-module bugs by @riqwan in #5685
  • fix(medusa): Update default relations in admin for list-product from module by @pKorsholm in #5708
  • fix(admin-ui): Fix issue with null product categories by @kasperkristensen in #5707
  • fix(admin-ui): Edit prices requires at least one product by @kasperkristensen in #5710
  • fix(medusa,pricing,types): rules only gets updated/deleted upon passing an explicit object by @riqwan in #5711
  • fix(pricing, types): update calculatePrices return type to match actual type by @pKorsholm in #5709
  • fix(medusa): pricing module list prices return type by @pKorsholm in #5715
  • fix(admin-ui): Fix Y-axis scroll in bulk editor by @kasperkristensen in #5726
  • fix(medusa,pricing): Fix migrations for existing databases by @riqwan in #5730
  • fix(admin-ui): inventory item deletion when removing product by @pKorsholm in #5727
  • fix(link-modules, utils): remove limits on queries when primary-key is provided by @pKorsholm in #5732
  • fix(admin-ui): fix height of Bulk Editor cells to always be 40px by @kasperkristensen in #5737

Chores

Documentation

New Contributors

Full Changelog: v1.18.0...v1.18.1

v1.18.0

21 Nov 09:15
9c7f95c
Compare
Choose a tag to compare

Highlights

Subscriber API + Scheduled Jobs API

This release comes with an improved Subscriber API and a new Scheduled Jobs API. These are drastic improvements of the developer experience of setting up event subscribers and cron jobs.

Subscriber API

// src/subscribers/product-update-handler.ts
import type { SubscriberConfig, SubscriberArgs, ProductService } from "@medusajs/medusa"

export default async function productUpdateHandler({ data, eventName, container, pluginOptions }: SubscriberArgs) {
  const productService: ProductService = container.resolve("productService")

  const { id } = data

  const product = await productService.retrieve(id)

  // do something with the product...
}

export const config: SubscriberConfig = {
  event: ProductService.Events.UPDATE
}

Scheduled Jobs API

// src/jobs/once-a-minute.ts
import type { ProductService, ScheduledJobConfig, ScheduledJobArgs }  from "@medusajs/medusa"

export default async function handler({ container, data, pluginOptions }: ScheduledJobArgs) {
  const productService: ProductService = container.resolve("productService")
  
  const count = await productService.count()

  console.log(`You have ${count} products`)
}

export const config: ScheduledJobConfig = {
  name: "every-minute",
  schedule: "* * * * *"
}

Read more about the new APIs in the PR details.

Breaking changes

Changes to feature flags

This version significantly changes the feature flags in our core @medusajs/medusa. We've decided to replace all module-specific feature flags with one that encapsulates all the work around modularizing Medusa further.

The following feature flags no longer exist:

Name Flag Environment variable
Product Module isolate_product_domain  MEDUSA_FF_ISOLATE_PRODUCT_DOMAIN
Pricing Module isolate_pricing_domain  MEDUSA_FF_ISOLATE_PRICING_DOMAIN

These feature flags have been replaced with one capturing all work for Medusa V2, releasing next year:

Name Flag Environment variable
Medusa V2 medusa_v2  MEDUSA_FF_MEDUSA_V2

Creating a NotificationService

The introduction of the new Subscriber API changes the recommended way to define the subscribers of a NotificationService. The recommended approach is to use a loader until our Subscriber API natively supports NotificationServices or we introduce a mechanism dedicated towards it.

Read more here.

Features

  • feat(pricing,types): price list API + price calculations with price lists by @riqwan in #5498
  • feat(workflows,medusa,utils): add medusa v2 feature flag by @riqwan in #5603
  • feat(medusa): Alternative Subscriber API and new ScheduledJobs API by @kasperkristensen in #5624
  • feat(medusa): Add metadata to Product Category by @bqst in #5599

Bugs

Chores

Documentation

New Contributors

Full Changelog: v1.17.4...v1.18.0