Skip to content
D
Documentation

Common issues and solutions

reference
5 min readUpdated

Common issues and solutions

Conduit troubleshooting falls into four reader jobs: starting the local application, connecting it to the API, checking routes, and separating signed-in behavior from signed-out behavior. Choose the check that matches the problem before changing the application.

If you need to…Go to
Prepare the local installation and connection detailsBefore you start
Start the application or change its API endpointStart the application and connect it to the API
Check which page each route opensCheck the declared routes
Compare signed-out and signed-in behaviorHandle signed-out and signed-in behavior
Interpret a returned API errorWhen a check fails
Continue with an account, navigation, or support taskWhat to do next

Before you start

Have the local project available and keep the expected connection details in view. The local web server uses port 4100. The default API root is https://conduit.productionready.io/api.

CheckValue or condition
DependenciesDependencies are installed.
Local serverRun npm start.
Local port4100
API roothttps://conduit.productionready.io/api
Authentication branchA JWT, the browser's authentication token, loads the current user when present; without one, the application loads without a current-user token.

If you are checking authenticated behavior, know whether the browser has a stored JWT before you compare the result with the signed-out path.

With these details ready, start the application and connect it to the API.

Start the application and connect it to the API

Start here when the local application is not running or when requests must go to a local API instead of the default API root.

Prerequisites

  • The project is available locally.
  • Dependencies are installed.
  • You know the API URL that the application must use.

Steps

  1. Open a terminal in the project folder.

  2. Enter npm install in the terminal.

  3. Run npm start.

  4. Check that the local server uses port 4100.

  5. If requests must use a local API, change the endpoint setting to the local server URL.

    For example, use http://localhost:3000/api as the local API URL.

  6. If the browser has a JWT, check requests that require authentication against the signed-in path. Token-bearing requests receive an authorization header using that token.

Result: The local application is started on port 4100, and its requests use the selected API root.

With the application running, check the routes that lead to the surface you need.

Check the declared routes

Open the fixed routes before checking a route that needs an article slug, article identifier, or username.

SurfaceHow to open it
HomeOpen /.
LoginOpen /login.
RegisterOpen /register.
New article editorOpen /editor.
Existing article editorOpen the editor route with an article slug.
ArticleOpen the article route with an article identifier.
SettingsOpen /settings.
Profile favoritesOpen the profile favorites route with a username.
ProfileOpen the profile route with a username.

Prerequisites

  • The local application is running.
  • You have an article slug for the existing article editor.
  • You have an article identifier for the article page.
  • You have a username for the profile and profile favorites pages.
If you want to check…Value to enter
An existing article editorThe article slug.
An article pageThe article identifier.
Profile favoritesThe profile username.
A profileThe profile username.

Steps

  1. Open the surface you want to check using the matching route or value in the table.
  2. Compare the opened surface with its intended surface.

Result: Each checked path opens its intended application surface, or the route that needs attention is identified.

If the surface changes with authentication, compare the signed-out and signed-in branches next.

Handle signed-out and signed-in behavior

The application chooses its current-user loading path from the presence of a JWT in browser local storage. Use the branch that matches the browser state you are checking.

If the browser…The application…
Has a JWT in local storageSets the token and loads the current user.
Does not have a JWT in local storageLoads without a current-user token.

When a token is present, requests use it in the authorization header. When no token is present, the token plugin does not set that header. Compare like with like: check the signed-in behavior with a stored JWT and the signed-out behavior without one.

If either branch produces an unexpected result, use the checks in the next section.

When a check fails

Compare the application rule with the API text you see.

What you seeWhat it meansWhat to check
An API error appears as a returned key followed by a returned valueThe application displays the returned error key and value.Read both parts of the displayed message.
A route does not match one of the listed surfacesThe declared route table has no explicit fallback route.Check the path spelling and any required slug, id, or username.
A signed-in request differs from a signed-out requestThe browser's JWT state changes current-user loading and request authorization.Check whether the browser has a JWT, then repeat the comparison using the matching branch.

The exact API error values come from the returned data rather than from a fixed application message. Use the displayed key and value when diagnosing the request.

After identifying the issue, continue with the task that matches it.

What to do next

Continue with the task that matches the problem:

Was this page helpful?

Download as PDF
Common issues and solutions — Conduit (React)