From 525b34d575ce62ba519038ecad1baeac906be396 Mon Sep 17 00:00:00 2001 From: Shahed Nasser Date: Thu, 20 Jul 2023 19:13:59 +0300 Subject: [PATCH] docs: added new troubleshooting sections (#4571) * docs: added troubleshooting section for EADDRINUSE * added custom hooks troubleshooting * fix tab issues * fix double active items in sidebar * Update sidebars.js --- docs/content/create-medusa-app.mdx | 5 +++++ docs/content/development/backend/install.mdx | 5 +++++ .../content/starters/nextjs-medusa-starter.mdx | 10 ++++++++++ .../troubleshooting/custom-hooks-error.md | 17 +++++++++++++++++ docs/content/troubleshooting/eaddrinuse.md | 18 ++++++++++++++++++ www/docs/sidebars.js | 10 ++++++++++ 6 files changed, 65 insertions(+) create mode 100644 docs/content/troubleshooting/custom-hooks-error.md create mode 100644 docs/content/troubleshooting/eaddrinuse.md diff --git a/docs/content/create-medusa-app.mdx b/docs/content/create-medusa-app.mdx index 73e3f4be07..714fdb2319 100644 --- a/docs/content/create-medusa-app.mdx +++ b/docs/content/create-medusa-app.mdx @@ -14,6 +14,7 @@ import OtherErrorsSection from "./troubleshooting/create-medusa-app-errors/_othe import EagainError from "./troubleshooting/create-medusa-app-errors/_eagain-error.md" import ConnectionErrorSection from './troubleshooting/database-errors/_connection-error.md' import FreshInstallationSection from './troubleshooting/awilix-resolution-error/_fresh-installation.md' +import EaddrinuseSection from './troubleshooting/eaddrinuse.md' # Install Medusa with create-medusa-app @@ -149,6 +150,10 @@ Based on what you're building, you can find a development path for you in the Re + }, { title: "EAGAIN error", content: diff --git a/docs/content/development/backend/install.mdx b/docs/content/development/backend/install.mdx index d505e226b0..bf4249aba6 100644 --- a/docs/content/development/backend/install.mdx +++ b/docs/content/development/backend/install.mdx @@ -10,6 +10,7 @@ import Troubleshooting from '@site/src/components/Troubleshooting' import SaslSection from '../../troubleshooting/database-errors/_sasl.md' import ConnectionErrorSection from '../../troubleshooting/database-errors/_connection-error.md' import FreshInstallationSection from '../../troubleshooting/awilix-resolution-error/_fresh-installation.md' +import EaddrinuseSection from '../../troubleshooting/eaddrinuse.md' # Install Medusa Backend @@ -99,6 +100,10 @@ curl localhost:9000/store/products title: 'Error: connect ECONNREFUSED ::1:5432', content: }, + { + title: 'Error: EADDRINUSE', + content: + }, { title: 'AwilixResolutionError: Could Not Resolve X', content: diff --git a/docs/content/starters/nextjs-medusa-starter.mdx b/docs/content/starters/nextjs-medusa-starter.mdx index a73e3cd8b8..534f269644 100644 --- a/docs/content/starters/nextjs-medusa-starter.mdx +++ b/docs/content/starters/nextjs-medusa-starter.mdx @@ -113,6 +113,16 @@ Your Next.js Starter Template is now running at `localhost:8000` ## Development Notes +### Changing Medusa Backend URL + +By default, the Medusa backend runs at `http://localhost:9000`. This value is defined in your Next.js starter template under the environment variable `NEXT_PUBLIC_MEDUSA_BACKEND_URL`. + +If you need to change the URL of your Medusa backend because you changed the backend's default port or because you deployed your backend, change the value of `NEXT_PUBLIC_MEDUSA_BACKEND_URL` (typically in `.env.local`) to your backend URL. For example: + +```bash +NEXT_PUBLIC_MEDUSA_BACKEND_URL=http://localhost:9001 +``` + ### Toggle Search Engine Feature The Next.js Starter Template by default is compatible with MeiliSearch. diff --git a/docs/content/troubleshooting/custom-hooks-error.md b/docs/content/troubleshooting/custom-hooks-error.md new file mode 100644 index 0000000000..fceba2667a --- /dev/null +++ b/docs/content/troubleshooting/custom-hooks-error.md @@ -0,0 +1,17 @@ +--- +title: createCustomAdminHooks Error +--- + +If you've installed Medusa prior to v1.12.3 with the `create-medusa-app` command, then you try to update the `@medusajs/medusa` and `@medusajs/admin` to the latest `beta` versions, you might run into the following error when running your Medusa backend: + +```bash +Module '"medusa-react"' has no exported member 'createCustomAdminHooks'. +``` + +This is because a previous version of `medusa-react` allowed creating custom hooks using `createCustomAdminHooks`. This has now changed to use different utility hooks, which you can learn about [the Medusa React documentation](../medusa-react/overview.mdx#custom-hooks). + +To resolve this issue, you have the following options: + +1. If you haven't used `createCustomAdminHooks` in your code, then you can delete the content of the `src/admin` directory which holds the widgets that create your onboarding flow, then try running your Medusa backend. +2. If you've used the `createCustomAdminHooks` in your code, refer to the [Medusa React](../medusa-react/overview.mdx#custom-hooks) to learn about the new utility hooks and how you can use them. + diff --git a/docs/content/troubleshooting/eaddrinuse.md b/docs/content/troubleshooting/eaddrinuse.md new file mode 100644 index 0000000000..a66558db33 --- /dev/null +++ b/docs/content/troubleshooting/eaddrinuse.md @@ -0,0 +1,18 @@ +--- +title: 'EADDRINUSE Error' +--- + +When you run your backend you may run to an error similar to the following: + +```bash +code: 'EADDRINUSE', +errno: -48, +syscall: 'Listen', +address: '::', +port: 9000 +``` + +This means that there's another process running at port `9000`. You need to either: + +- Change the default port used by the Medusa backend. You can do that by setting the `PORT` environment variable to a new port. When you do this, make sure to change the port used in other apps that interact with your Medusa backend, such as in your [admin](../admin/quickstart.mdx#build-command-options) or [storefront](../starters/nextjs-medusa-starter.mdx#changing-medusa-backend-url). +- Terminate other processes running on port `9000`. diff --git a/www/docs/sidebars.js b/www/docs/sidebars.js index b8d500a928..096a8aa84e 100644 --- a/www/docs/sidebars.js +++ b/www/docs/sidebars.js @@ -361,6 +361,11 @@ module.exports = { type: "category", label: "Medusa Backend Errors", items: [ + { + type: "doc", + id: "troubleshooting/eaddrinuse", + label: "EADDRINUSE Error", + }, { type: "doc", id: "troubleshooting/database-error", @@ -403,6 +408,11 @@ module.exports = { id: "troubleshooting/signing-in-to-admin", label: "Signing in to the Admin Dashboard", }, + { + type: "doc", + id: "troubleshooting/custom-hooks-error", + label: "Custom Hooks Error", + }, ], }, {