crumbtraildocs

Record a customer's problem so your team can see it happen

When a customer says "it broke", the hardest part is seeing exactly what they saw. This guide shows you how to switch on a short recording for one customer, let them repeat what they did, and hand your developers a saved copy of the exact moment it went wrong.

About 15 minutes the first timeNo changes to your app's code

The short version

  • You record one customer at a time, for a limited time. A recording window lasts 30 minutes or 100 requests, whichever comes first, and then closes by itself.
  • Nothing needs to restart and no code changes. Once Crumbtrail is set up, starting a recording is one command.
  • A recording is the evidence, not the answer. It saves what happened. Your developers then play it back to confirm the problem and find the cause.
  • Passwords are never saved. If a request carries a password or similar secret that Crumbtrail cannot safely hide, it skips that request instead of writing the secret down.

Words used in this guide

WordWhat it means
TerminalThe text window where you type commands. On a Mac it is the app called Terminal. Each grey box below is something you paste into it.
RequestOne thing the customer's browser asks your app to do, such as "load my cart" or "place my order". A visit to your app is made of many requests.
SessionOne recording window for one customer, from the moment you start it until you stop it or it runs out.
CapsuleThe saved copy of one request: what was asked, what went wrong, and the data your app looked at while answering. This is what you hand to your developers.
Recording inboxA private web page inside your app where you can see sessions and download a capsule without typing commands.

Before you start

Most of this needs doing only once. If you are not sure about any of it, ask whoever set up your app.

  • Crumbtrail is already installed on your app. Your developer does this once with crumbtrail install. You can tell it is done if the app's folder contains a folder called .crumbtrail.
  • You are working on a test copy of your app, not the live one. The recording inbox refuses to run on a live (production) app, on purpose.
  • You know how this customer is identified. When Crumbtrail was installed, your developer chose what tells one customer apart from another, such as an account ID. You will type that value in step 2.
  • Your app is started with the ports tool. This gives the app a free address to run on so it does not clash with anything else. Start it like this, replacing the part in angle brackets with your usual start command:
Terminal · start your app
ports run crumbtrail -- <your app start command>
01

Switch on the recording inbox

The recording inbox is the private page where you will find and download recordings later. You switch it on by adding four settings to your app's settings file (usually called .env, in the app's main folder), then restarting the app.

.env · add these four lines
NODE_ENV=development
CRUMBTRAIL_INBOX_ENABLED=1
CRUMBTRAIL_INBOX_TOKEN=<a private value you will type into the page>
CRUMBTRAIL_INBOX_HOSTS=127.0.0.1:21531
SettingWhat to put
NODE_ENVLeave it as development. This marks the app as a test copy; the inbox will not run otherwise.
CRUMBTRAIL_INBOX_ENABLEDLeave it as 1. This switches the inbox on.
CRUMBTRAIL_INBOX_TOKENMake up a long private phrase, like a password, and keep it somewhere safe. You type it into the inbox page to open it. It is never shown in the address bar or saved in a recording.
CRUMBTRAIL_INBOX_HOSTSThe web address you will open the inbox at, without http://. Replace the example with your app's own address and port. If you list more than one, separate them with commas.
If the app will not start after this, that is on purpose. When the inbox is switched on but a setting is missing or empty, the app stops and its message names the missing setting. Fill it in and start the app again.

You will know it worked when the app's startup messages include a line beginning [repro] recording inbox on /_crumbtrail/. Now open your app's address followed by /_crumbtrail/recordings in a browser, for example http://127.0.0.1:21531/_crumbtrail/recordings, and type your private phrase. You should see the words "No sessions yet".

02

Record the customer repeating the problem

Open your terminal in the app's main folder. Then follow these four steps in order, pasting one line at a time. Replace customer-123 with the value that identifies your customer (see "Before you start").

Terminal · 1. start recording this customer
crumbtrail support start --customer "customer-123"

Now ask the customer to do exactly what they did when the problem happened. Only their requests are recorded; other customers using the app at the same time are left alone. To check the recording is running, paste:

Terminal · 2. check it is recording
crumbtrail support status

As soon as the customer says "there, it just broke", mark that moment. This tags their most recent request so you can find it easily later:

Terminal · 3. mark the moment it broke
crumbtrail support mark --last

When you have what you need, stop recording. Anything the customer does after this is not recorded.

Terminal · 4. stop recording
crumbtrail support stop

Need more time? Add --minutes 60 to the start command to keep the window open for an hour instead of 30 minutes.

If your app runs on several servers, every one of them must answer when you start. If one does not, you will see Session incomplete: followed by the server's name. Ask your developer to check that server, then start again.

03

Find the recording

The easy way: open the recording inbox page from step 1 and type your private phrase. You will see your session, with the request you marked flagged. Select it and press download. This saves a single file you can send to your developers.

The terminal way: the first command lists every session with an ID for each. Copy the ID of yours into the second command to see every request in it.

Terminal · list and open sessions
crumbtrail support list
crumbtrail support show <session id>

Next to each request you will see whether a capsule was saved for it:

presentSaved. This is the one to send.
missingNothing was saved, either because the request worked fine or because it carried a secret Crumbtrail will not write down.

A capsule marked invalid is damaged; record the problem again.

04

Send it to your developers

If you downloaded the file from the inbox page in step 3, send that file and skip to step 5. Otherwise, make the file from the terminal on the computer that recorded it. Fill in the session ID from step 3, then the request. In support show each line starts with the server's name and the request's number, such as default #4. Type that as default:4.

Terminal · on the computer that recorded it
crumbtrail support export <session id> <instance:index> --output /tmp/recording.tar

This creates a file called recording.tar in your computer's temporary folder. Send it to your developer the way you normally share files. On their computer, they unpack it with:

Terminal · on the developer's computer
crumbtrail support import /tmp/recording.tar --into ~/crumbtrail-imports

You will know it worked when the import prints a line starting Imported: followed by the folder it created. The developer needs that folder for step 5.

The export will refuse if the session lost some requests, or if the app's secret settings have changed since the recording. Both are there to stop a broken or unsafe file leaving your computer. Record again if you see either.

05

Your developer plays it back

This step is usually done by a developer. Crumbtrail runs the recorded request against their copy of the app 10 times, using only the data saved in the capsule and with no connection to your real systems. Their copy must be the same version of the app that was recorded, or playback will refuse to start.

Terminal · play the recording back
ports run crumbtrail -- crumbtrail replay ~/crumbtrail-imports/import-XXXXXX \
  --source-root ~/repos/your-app --runs 10

Replace import-XXXXXX with the folder name from step 4, and ~/repos/your-app with where their copy of the app lives.

Same failure 10 out of 10The problem is confirmed. Your developers can now fix it and use the same recording to check the fix.
Any run differsThe problem could not be repeated reliably. Even 9 out of 10 does not count. Record it again, ideally marking the exact moment.

A confirmed problem is not yet a fixed one. Checking that a fix really works is a separate step.

If something goes wrong

What you seeWhat it means and what to do
A blank page with the code 403The address you opened is not on the inbox's list. Copy the address from your browser (without http://) into CRUMBTRAIL_INBOX_HOSTS exactly, and restart the app.
401 when opening sessionsThe private phrase was not typed or does not match. Type it again, checking it matches CRUMBTRAIL_INBOX_TOKEN.
"No sessions yet"Nothing has been recorded. Start a session (step 2) and have the customer repeat the problem.
Gaps: in support showThe session lost some requests, usually because a server stopped. The export will refuse it. Record again.
Replay setup: incompleteThe recording is missing the instructions for playing it back. Ask your developer to run crumbtrail finalize on the computer that recorded it, then send the file again.
no ports allocator lane is activeThe command was started without the ports tool. Put ports run crumbtrail -- in front of it and try again.