Highlights
Passing custom callback to Oauth providers
Warning
Breaking changes
The callback URL for Oauth providers can now be passed in the payload of the authentication request to support use cases like different login pages based on the actor.
For example, you might have a user/github/callback
page and a customer/github/callback
page, and where you redirect to would depend on which actor is doing the authentication.
The request would look as follows:
POST http://localhost:9000/customer/auth/github
{ callback_url: "<some url>" }
This change also adds the state
parameter as defined in the Oauth protocol.
Required actions
If you have overridden the auth module definition in medusa-config.ts
, you will need to pass Modules.CACHE
as a dependency, as the state
is stored temporarily in cache when carrying out the authentication flow:
module.exports = defineConfig({
...
modules: [
{
resolve: "@medusajs/medusa/auth",
dependencies: [Modules.CACHE, ContainerRegistrationKeys.LOGGER],
options: {
providers: [ ... ],
},
},
],
})
Custom module types
Container mappings types are generated for modules by inspecting the registered modules. The types are generated and written to your local project in .medusa/types/module-bindings.d.ts
. To generate the types, the module needs be functionally correct, registered in medusa-config.ts
, and the server needs to be started in development mode.
Once the types are generated, your IDEs intellisense should pick them up, e.g. when creating an API Route:
import type { MedusaRequest, MedusaResponse } from "@medusajs/framework/http"
export const GET = (req: MedusaRequest, res: MedusaResponse) => {
const brandModule = req.scope.resolve("brand")
await brandModule. // <-------------- Autocompletion should appear
...
}
If you experience issues with generating types for custom modules, please submit an issue, so we can look into it.
Deprecated APIs
Some APIs have been deprecated and/or renamed as part of a housekeeping task in order to be more consistent with naming across tools and modules.
These are:
remoteLink
->link
(deprecated and renamed)remoteQueryConfig
->queryConfig
(deprecated and renamed)remote-query-entry-points.d.ts
->query-entry-points.d.ts
(renaming)
There are no breaking changes in this release, but the deprecated APIs will be removed in a later release, so we recommend updating your code to use the new APIs as soon as possible.
Order cancelation
Canceling an order will also cancel its payments. If the payments are captured, we will attempt to refund an amount equal to the captured amount. If the payments are not captured, they will be canceled immediately.
Other changes
The relationship between stock location and stock location address has been changed to a one-to-one. This change involves a migration, so please apply the latest migrations when upgrading.
Required actions
Run migrations to ensure your server functions as expected after upgrading:
npx medusa db:migrate
Features
- feat(medusa): Add health endpoint for all running modes of medusa by @sradevski in #10737
- feat(create-medusa-app): allow passing project name on command line by @shahednasser in #10755
- feat: deprecate remote link by @thetutlage in #10768
- feat: deprecate remoteQueryConfig in favor of queryConfig by @thetutlage in #10773
- feat: generate modules mappings at runtime by @thetutlage in #10791
- feat(create-medusa-app): improve by adding depth to clone commands by @shahednasser in #10812
- feat(auth-google,auth-github): Allow passing a custom callbackUrl to β¦ by @sradevski in #10829
- feat(dashboard,core-flows,types,utils,medusa): Order cancelations will refund payments by @riqwan in #10667
Bugs
- fix(fulfillment): export schema types by @shahednasser in #10700
- fix: pluralization of words ending in y, where y follows a vowel by @thetutlage in #10697
- fix(medusa,types,js-sdk): fix request query parameter types for store product routes by @shahednasser in #10707
- fix(core-flows): export updateTaxRegionsStep by @shahednasser in #10732
- fix(pricing): pricing context calculations only takes into account existing rule attributes by @riqwan in #10771
- Fix/product variants filter by @thetutlage in #10808
- fix(): Workflow cancellation + gracefully handle non serializable state by @adrien2p in #10674
- fix(core-flow): invalid update quantity in update line item in cart workflow by @daykrm in #10405
- fix(promotion): don't evaluate rule condition if conditions to evaluate is empty by @riqwan in #10795
- fix(stock-location,core-flows,types): updates existing address when updating stock location by @riqwan in #10832
- feat(core-flows,fulfillment, fulfillment-manual, types): make fulfillment typings more specific by @fPolic in #10677
- fix(create-medusa-app): add default storefront url to auth CORS by @shahednasser in #10853
- fix(dashboard): cancel order notifications by @fPolic in #10858
Documentation
- docs: integrate shipstation guide by @shahednasser in #10623
- docs: update typedoc, convert packages to esm, generate references by @shahednasser in #10699
- docs: fix typo in CmsModuleService by @shahednasser in #10702
- docs-util: fix links in references to current page by @shahednasser in #10703
- docs-util: fix query params not retrieved correctly for some routes by @shahednasser in #10708
- docs: split commerce modules sidebars by @shahednasser in #10705
- docs: fix typo in extend core flow by @shahednasser in #10709
- docs: split events reference across modules by @shahednasser in #10711
- docs: split admin widget zone to pages by @shahednasser in #10719
- docs: improve link docs for commerce modules by @shahednasser in #10726
- docs: fix multiple typos in customization chapters by @shahednasser in #10727
- docs: add workflow / step tags by @shahednasser in #10731
- docs: revise commerce modules overview pages by @shahednasser in #10738
- docs: add JS SDK to commerce modules sidebars by @shahednasser in #10740
- chore: improve payment provider tsdocs + generate reference by @shahednasser in #10742
- docs: fix and improve details on sending authenticated requests with API token by @shahednasser in #10744
- docs-util: add publishable api key header parameter to store routes OAS by @shahednasser in #10747
- docs: document how to calculate shipping prices in storefront by @shahednasser in #10748
- docs: allow scroll with keys by @shahednasser in #10752
- docs: update and fix UI props docs by @shahednasser in #10754
- docs: document missing events in reference by @shahednasser in #10779
- docs: update fulfillment provider module docs to reflect CalculatedShippingOptionPrice by @ranjithkumar8352 in #10778
- docs: fix code tabs in production by @shahednasser in #10784
- docs: fix selected variant in storefront guide by @shahednasser in #10785
- chore: fix links to contribution guidelines by @shahednasser in #10792
- docs: fix highlights in checkout storefront guide by @shahednasser in #10793
- docs: fix cross-project link for Card components by @shahednasser in #10794
- docs: handle product deletion in digital products recipe by @shahednasser in #10811
- docs: fix storefront sections in digital product recipe by @shahednasser in #10833
- docs: update next.js storefront snippets by @shahednasser in #10840
- docs: update storefront development snippets for next.js 15 compatibility by @shahednasser in #10843
- Update page.mdx by @DivineStudio in #10847
- docs: document registering user with existing email by @shahednasser in #10859
Chores
- chore(ui,icons): Add React 19/19-rc to peer dependencies by @kasperkristensen in #10458
- chore(js-sdk): add tags to js-sdk by @shahednasser in #10739
- chore: small tsdoc changes for remoteLink and remoteQueryConfig by @shahednasser in #10837
- chore(ui): general updates and fixes to TSDocs and types by @shahednasser in #10753
- chore: fix version number in tsdocs by @shahednasser in #10856
- chore: rename remote-query-entry-points.d.ts to query-entry-points.d.ts by @thetutlage in #10831
Other Changes
- fix(medusa-cli): fix medusa develop command crashing on file change on windows by @ranjithkumar8352 in #10717
- docs: use correct env variable for medusa admin in server mode deployment by @ranjithkumar8352 in #10764
- docs: update desktop nav menu item title by @ahrbil in #10125
- Update README.md by @MedusaNick in #10825
New Contributors
- @ranjithkumar8352 made their first contribution in #10717
- @daykrm made their first contribution in #10405
- @DivineStudio made their first contribution in #10847
Full Changelog: v2.1.3...v2.2.0