From 5d1965f2fa0faf5e51b72e691fa74a8b70f7e777 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Mon, 15 Jan 2024 13:33:53 +0200 Subject: [PATCH] docs: add new troubleshooting section for create-medusa-app (#6071) * docs: add new troubleshooting section for create-medusa-app * small fixes --- www/apps/docs/content/create-medusa-app.mdx | 5 +++++ .../troubleshooting/create-medusa-app-errors.mdx | 7 +++++++ .../troubleshooting/create-medusa-app-errors/_port.md | 10 ++++++++++ 3 files changed, 22 insertions(+) create mode 100644 www/apps/docs/content/troubleshooting/create-medusa-app-errors/_port.md diff --git a/www/apps/docs/content/create-medusa-app.mdx b/www/apps/docs/content/create-medusa-app.mdx index 9745e27dcf..f3de6fed2b 100644 --- a/www/apps/docs/content/create-medusa-app.mdx +++ b/www/apps/docs/content/create-medusa-app.mdx @@ -18,6 +18,7 @@ import EaddrinuseSection from './troubleshooting/eaddrinuse.md' import InvalidTokenError from './troubleshooting/create-medusa-app-errors/_no-browser-token-error.md' import PostgresDockerError from './troubleshooting/database-errors/_docker.md' import DbUrlError from './troubleshooting/create-medusa-app-errors/_db-url-error.md' +import PortError from './troubleshooting/create-medusa-app-errors/_port.md' # Install Medusa with create-medusa-app @@ -218,6 +219,10 @@ Based on what you're building, you can find a development path for you in the Re + }, { title: 'Can\'t connect to database with --db-url option', content: diff --git a/www/apps/docs/content/troubleshooting/create-medusa-app-errors.mdx b/www/apps/docs/content/troubleshooting/create-medusa-app-errors.mdx index 03bd4e11d8..3b7858fa8c 100644 --- a/www/apps/docs/content/troubleshooting/create-medusa-app-errors.mdx +++ b/www/apps/docs/content/troubleshooting/create-medusa-app-errors.mdx @@ -7,6 +7,7 @@ import OtherErrors from './create-medusa-app-errors/_other-errors.mdx' import InvalidTokenError from './create-medusa-app-errors/_no-browser-token-error.md' import DockerSection from "./database-errors/_docker.md" import DbUrlError from './create-medusa-app-errors/_db-url-error.md' +import PortError from './create-medusa-app-errors/_port.md' ## TypeError: cmd is not a function @@ -14,6 +15,12 @@ import DbUrlError from './create-medusa-app-errors/_db-url-error.md' --- +## Admin Login or User Errors + + + +--- + ## Invalid Token Error with --no-browser Option diff --git a/www/apps/docs/content/troubleshooting/create-medusa-app-errors/_port.md b/www/apps/docs/content/troubleshooting/create-medusa-app-errors/_port.md new file mode 100644 index 0000000000..99a346d4a8 --- /dev/null +++ b/www/apps/docs/content/troubleshooting/create-medusa-app-errors/_port.md @@ -0,0 +1,10 @@ +By default, the Medusa backend runs on `localhost:9000`. However, the port may change based on the `PORT` environment variable. + +If you run the `create-medusa-app` command, and the installation finishes successfully, but the backend runs on a different port than `9000`, it may cause errors when you try to create an admin user or login during the onboarding process. This could either be because you have the `PORT` environment variable set to something differnt, or because of port forwarding. + +To resolve this, you must: + +1. Terminate the `create-medusa-app` process and change to the new backend's directory. +2. Either explicitely set the `PORT` environment variable to `9000`, or set the environment variable `MEDUSA_ADMIN_BACKEND_URL` to the backend's URL. For example, if the backend is running on `localhost:7000`, change the `MEDUSA_ADMIN_BACKEND_URL` to `http://localhost:7001`. This ensures that the admin uses the correct port. In case of port fowarding, it's recommended to explicitely set the `PORT` environment variable. +3. Create an admin user using the [user command of the CLI tool](../../cli/reference.mdx#user). +4. Start the backend again either with the `dev` command of the backend project or using `npx medusa develop` and try to login again.