Skip to content

Commit e3e3c72

Browse files
authored
docs: triage issues + revamp troubleshooting guides (#14216)
* docs: triage issues + revamp troubleshooting guides * small change
1 parent a00bba5 commit e3e3c72

File tree

23 files changed

+126
-69
lines changed

23 files changed

+126
-69
lines changed

www/apps/book/app/learn/installation/page.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ While this is the recommended way to create a Medusa application, you can altern
2828

2929
<Prerequisites items={[
3030
{
31-
text: "Node.js v20+ (LTS versions)",
31+
text: "Node.js v20+ (LTS versions only)",
3232
link: "https://nodejs.org/en/download"
3333
},
3434
{
3535
text: "Git CLI tool",
3636
link: "https://git-scm.com/downloads"
3737
},
3838
{
39-
text: "PostgreSQL",
39+
text: "PostgreSQL installed and running",
4040
link: "https://www.postgresql.org/download/"
4141
}
4242
]} />

www/apps/book/generated/edit-dates.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ export const generatedEditDates = {
9696
"app/learn/build/page.mdx": "2025-10-27T09:30:26.957Z",
9797
"app/learn/deployment/general/page.mdx": "2025-10-21T07:39:08.998Z",
9898
"app/learn/fundamentals/workflows/multiple-step-usage/page.mdx": "2025-08-01T14:59:59.501Z",
99-
"app/learn/installation/page.mdx": "2025-11-26T12:14:47.372Z",
99+
"app/learn/installation/page.mdx": "2025-12-04T14:30:00.510Z",
100100
"app/learn/fundamentals/data-models/check-constraints/page.mdx": "2025-07-25T13:50:21.065Z",
101101
"app/learn/fundamentals/module-links/link/page.mdx": "2025-11-28T13:42:03.037Z",
102102
"app/learn/fundamentals/workflows/store-executions/page.mdx": "2025-04-17T08:29:10.166Z",

www/apps/book/public/llms-full.txt

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25386,9 +25386,9 @@ While this is the recommended way to create a Medusa application, you can altern
2538625386

2538725387
### Prerequisites
2538825388

25389-
- [Node.js v20+ (LTS versions)](https://nodejs.org/en/download)
25389+
- [Node.js v20+ (LTS versions only)](https://nodejs.org/en/download)
2539025390
- [Git CLI tool](https://git-scm.com/downloads)
25391-
- [PostgreSQL](https://www.postgresql.org/download/)
25391+
- [PostgreSQL installed and running](https://www.postgresql.org/download/)
2539225392

2539325393
To create a Medusa application, use the `create-medusa-app` command:
2539425394

@@ -46123,7 +46123,7 @@ const step1 = createStep(
4612346123
"step-1",
4612446124
async ({}, { container }) => {
4612546125
const eventModuleService = container.resolve(
46126-
Modules.EVENT
46126+
Modules.EVENT_BUS
4612746127
)
4612846128

4612946129
await eventModuleService.emit({
@@ -46162,7 +46162,7 @@ Medusa provides the following Event Modules. You can use one of them, or [Create
4616246162

4616346163
The Redis Event Module uses Redis to implement Medusa's pub/sub events system.
4616446164

46165-
It's powered by BullMQ and `io-redis`. BullMQ is responsible for the message queue and worker, and `io-redis` is the underlying Redis client that BullMQ connects to for events storage.
46165+
It's powered by [BullMQ](https://bullmq.io/) and `io-redis`. BullMQ is responsible for the message queue and worker, and `io-redis` is the underlying Redis client that BullMQ connects to for events storage.
4616646166

4616746167
In production, it's recommended to use this module.
4616846168

@@ -46190,6 +46190,19 @@ module.exports = defineConfig({
4619046190
resolve: "@medusajs/medusa/event-bus-redis",
4619146191
options: {
4619246192
redisUrl: process.env.EVENTS_REDIS_URL,
46193+
// suggested additional options for production use
46194+
jobOptions: {
46195+
removeOnComplete: {
46196+
// keep jobs for 1 hour or up to 1000 jobs
46197+
age: 3600,
46198+
count: 1000,
46199+
},
46200+
removeOnFail: {
46201+
// keep jobs for 1 hour or up to 1000 jobs
46202+
age: 3600,
46203+
count: 1000,
46204+
}
46205+
}
4619346206
},
4619446207
},
4619546208
],

www/apps/resources/app/infrastructure-modules/event/page.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ const step1 = createStep(
4545
"step-1",
4646
async ({}, { container }) => {
4747
const eventModuleService = container.resolve(
48-
Modules.EVENT
48+
Modules.EVENT_BUS
4949
)
5050

5151
await eventModuleService.emit({

www/apps/resources/app/infrastructure-modules/event/redis/page.mdx

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ export const metadata = {
88

99
The Redis Event Module uses Redis to implement Medusa's pub/sub events system.
1010

11-
It's powered by BullMQ and `io-redis`. BullMQ is responsible for the message queue and worker, and `io-redis` is the underlying Redis client that BullMQ connects to for events storage.
11+
It's powered by [BullMQ](https://bullmq.io/) and `io-redis`. BullMQ is responsible for the message queue and worker, and `io-redis` is the underlying Redis client that BullMQ connects to for events storage.
1212

1313
In production, it's recommended to use this module.
1414

@@ -47,6 +47,19 @@ module.exports = defineConfig({
4747
resolve: "@medusajs/medusa/event-bus-redis",
4848
options: {
4949
redisUrl: process.env.EVENTS_REDIS_URL,
50+
// suggested additional options for production use
51+
jobOptions: {
52+
removeOnComplete: {
53+
// keep jobs for 1 hour or up to 1000 jobs
54+
age: 3600,
55+
count: 1000,
56+
},
57+
removeOnFail: {
58+
// keep jobs for 1 hour or up to 1000 jobs
59+
age: 3600,
60+
count: 1000,
61+
}
62+
}
5063
},
5164
},
5265
],

www/apps/resources/app/storefront-development/customers/register/page.mdx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,12 @@ To register a customer, you implement the following steps:
2828

2929
1. Show the customer a form to enter their details.
3030
2. Send a `POST` request to the `/auth/customer/emailpass/register` [Get Registration Token](!api!/store#auth_postactor_typeauth_provider_register) API route to obtain a registration JWT token.
31-
3. Send a request to the [Create Customer API route](!api!/store#customers_postcustomers) passing the registration JWT token in the header.
31+
3. Send a request to the [Register Customer API route](!api!/store#customers_postcustomers) passing the registration JWT token in the header.
3232

3333
However, a customer may enter an email that's already used either by an admin user, another customer, or a [custom actor type](../../../commerce-modules/auth/auth-identity-and-actor-types/page.mdx). To handle this scenario:
3434

3535
- Try to obtain a login token by sending a `POST` request to the `/auth/customer/emailpass` [Authenticate Customer](!api!/store#auth_postactor_typeauth_provider) API route. The customer is only allowed to register if their email and password match the existing identity. This allows admin users to log in or register as customers.
36-
- If you obtained the login token successfully, create the customer using the login JWT token instead of the registration token. This will not remove the existing identity. So, for example, an admin user can also become a customer.
36+
- If you obtained the login token successfully, register the customer using the login JWT token instead of the registration token. This will not remove the existing identity. So, for example, an admin user can also become a customer.
3737

3838
When you're using the JS SDK, this flow is simplified with quick registration and login methods. The rest of this guide uses the JS SDK to demonstrate the registration flow. However, if you're not using the JS SDK, you can still implement the same flow using the API routes.
3939

@@ -186,7 +186,7 @@ export const fetchHighlights = [
186186
["11", "catch", "Maybe another identity exists with the same email."],
187187
["21", "login", "Try to obtain a login JWT token."],
188188
["24", "catch", "The existing account belongs to another customer, so authentication failed."],
189-
["40", "create", "Send a request to create the customer."],
189+
["40", "create", "Send a request to register the customer."],
190190
["47", "TODO", "Redirect the customer to the log in page."],
191191
["48", "catch", "Handle registration failure"],
192192
]
@@ -211,7 +211,7 @@ export const fetchHighlights = [
211211
}
212212
// another identity (for example, admin user)
213213
// exists with the same email. So, use the auth
214-
// flow to login and create a customer.
214+
// flow to login and register a customer.
215215
const loginResponse = (await sdk.auth.login("customer", "emailpass", {
216216
email,
217217
password,
@@ -229,7 +229,7 @@ export const fetchHighlights = [
229229
}
230230
}
231231

232-
// create customer
232+
// register customer
233233
try {
234234
const { customer } = await sdk.store.customer.create({
235235
first_name: firstName,
@@ -256,7 +256,7 @@ In the above example, you create a `handleRegistration` function that:
256256
- If the error is an existing identity error, try retrieving the login JWT token from `/auth/customer/emailpass` API route using the `auth.login` method. This will fail if the existing identity has a different password, which doesn't allow the customer from registering.
257257
- For other errors, show an alert and exit execution.
258258
- The JS SDK automatically stores an re-uses the authentication headers or session in the `auth.register` and `auth.login` methods. So, if you're not using the JS SDK, make sure to pass the received authentication tokens as explained in the [API reference](!api!/store#1-bearer-authorization-with-jwt-tokens)
259-
- Send a request to the [Create Customer API route](!api!/store#customers_postcustomers) to create the customer in Medusa.
259+
- Send a request to the [Register Customer API route](!api!/store#customers_postcustomers) to register the customer in Medusa.
260260
- If an error occurs, show an alert and exit execution.
261261
- As mentioned, the JS SDK automatically sends the authentication headers or session in all requests after registration or logging in. If you're not using the JS SDK, make sure to pass the received authentication tokens as explained in the [API reference](!api!/store#1-bearer-authorization-with-jwt-tokens).
262262
- Once the customer is registered successfully, you can either redirect the customer to the login page or log them in automatically, as explained in the [Login](../login/page.mdx) guide.
Lines changed: 18 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
1-
You may get the following error while running `medusa new`:
1+
When installing or running Medusa, you may get errors while Medusa tries to connect to your PostgreSQL database.
2+
3+
For example, you may get one of the following errors:
24

35
```bash
6+
Error: connect ECONNREFUSED ::1:5432
47
Error: SASL: SCRAM-SERVER-FIRST-MESSAGE: client password must be a string
58
```
69

7-
If the error occurs while running `medusa new` and you've selected to enter your database credentials, either:
10+
### Error During Installation
811

9-
1. Make sure your database credentials are correct;
10-
2. Or choose the Skip option to skip entering your database credentials.
12+
If the connectivity error occurs while running `create-medusa-app`, it means you passed incorrect database credentials when prompted during the installation. Make sure that:
1113

12-
If the error occurs while running integration tests, make sure the following variable is set in your system's environment variable:
14+
1. PostgreSQL is installed and running on your machine;
15+
2. Your PostgreSQL server is configured at `localhost:5432` (the default host and port); If not, you can pass the `--db-url <url>` flag to the `create-medusa-app` command to specify a custom database URL;
16+
3. You're passing correct username and password for your PostgreSQL database;
17+
4. You're using a user that has privileges to create new databases;
18+
5. You're passing correct database name for your PostgreSQL user. It should have the same name as your PostgreSQL user by default.
1319

14-
```bash
15-
DB_HOST=<YOUR_DB_HOST>
16-
DB_USERNAME=<YOUR_DB_USERNAME>
17-
DB_PASSWORD=<YOUR_PASSWORD>
18-
```
20+
### Error During Development
21+
22+
If the error occurs while running integration tests, make sure that:
23+
24+
1. The `DATABASE_URL` environment variable is set correctly in your `.env` file;
25+
2. The [projectConfig.databaseUrl](!docs!/learn/configurations/medusa-config#databaseurl) field in your `medusa-config.js` file is set to the `DATABASE_URL` environment variable;
26+
3. The database URL is using correct username and password, and points to a running PostgreSQL database instance.

www/apps/resources/app/troubleshooting/create-medusa-app-errors/page.mdx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,23 @@ import InvalidTokenError from "../_sections/create-medusa-app-errors/no-browser-
55
import DockerSection from "../_sections/database-errors/docker.mdx"
66
import DbUrlError from "../_sections/create-medusa-app-errors/db-url-error.mdx"
77
import ForwardingError from "../_sections/create-medusa-app-errors/forwarding.mdx"
8+
import SaslSection from '../_sections/database-errors/sasl.mdx'
9+
import ModuleXErrorSection from '../_sections/common-installation-errors/module-x-error.mdx'
810

911
export const metadata = {
1012
title: `Common create-medusa-app Errors`,
1113
}
1214

1315
# {metadata.title}
1416

17+
This troubleshooting guide covers common errors you may encounter when using the `create-medusa-app` command to set up a new Medusa application and how to resolve them.
18+
19+
## General Errors Connecting to Database
20+
21+
<SaslSection />
22+
23+
---
24+
1525
## TypeError: cmd is not a function
1626

1727
<TypeError />
@@ -48,6 +58,12 @@ export const metadata = {
4858

4959
---
5060

61+
## Resolve "Cannot find module X" Errors
62+
63+
<ModuleXErrorSection />
64+
65+
---
66+
5167
## Other Errors
5268

5369
<OtherErrors />
Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import SaslSection from '../_sections/database-errors/sasl.mdx'
22
import ConnectionErrorSection from '../_sections/database-errors/connection-error.mdx'
3-
import PrivilegesSection from '../_sections/database-errors/privileges.mdx'
43
import DockerSection from "../_sections/database-errors/docker.mdx"
54

65
export const metadata = {
@@ -9,24 +8,14 @@ export const metadata = {
98

109
# {metadata.title}
1110

12-
## Can't Connect to PostgreSQL Docker Container
13-
14-
<DockerSection />
11+
This troubleshooting guide covers common database errors you may encounter when working with Medusa and how to resolve them.
1512

16-
---
17-
18-
## Error: SASL: SCRAM-SERVER-FIRST-MESSAGE: Client password must be a string
13+
## General Errors Connecting to Database
1914

2015
<SaslSection />
2116

2217
---
2318

24-
## Error: connect ECONNREFUSED ::1:5432
25-
26-
<ConnectionErrorSection />
27-
28-
---
29-
30-
## Database User Privileges
19+
## Can't Connect to PostgreSQL Docker Container
3120

32-
<PrivilegesSection />
21+
<DockerSection />
Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
11
export const metadata = {
2-
title: `Errors After Upgrading`,
2+
title: `Errors After Upgrading Medusa`,
33
}
44

55
# {metadata.title}
66

7-
If you run into errors after updating Medusa and its dependencies, it's highly recommended to check the Upgrade Guides if there is a specific guide for your version. These guides include steps required to perform after upgrading Medusa.
7+
If you run into errors after updating your Medusa application, it's highly recommended to check the [GitHub Release Notes](https://github.com/medusajs/medusa/releases) for any upgrade guides related to the version you upgraded to. These release notes may include details on breaking changes and how to resolve them before upgrading.
88

9-
If there's no upgrade guide for your version, make sure that you ran the `db:migrate` command in the root directory of your Medusa application:
9+
Also, after updating your Medusa application, make sure that you ran the `db:migrate` command in the root directory of your Medusa application:
1010

1111
```bash
1212
npx medusa db:migrate
1313
```
1414

1515
This ensures your application has the latest database structure required. Then, try running your Medusa application again and check whether the same error occurs.
16+
17+
## Additional Resources
18+
19+
- [Updating Medusa](!docs!/learn/update)

0 commit comments

Comments
 (0)