Debugging

When deploying your project to Begin, you may occasionally run into issues caused by solar flares, increased tidal activity or — in some extremely rare cases — bugs in your code. The Begin CLI provides a way to debug your build or application code.

Builds

If your app only has one environment, you can execute the command:

begin builds
npx begin builds

If your app has more than one environment, you’ll need to specify which environment you want to get build information from:

begin builds --env staging
npx begin builds --env staging

Regardless of which of the above commands you use, you will be presented with an interface which looks like:

begin-example-app (app ID: XXXXXXXX)
└── staging (env ID: STGXXXXX): https://local-fih.begin.app
? View detailed build logs? (ctrl-c to skip) …
  success - 6ddb285 - 11/29/2022 1:58:26 PM
❯ success - b4cc768 - 11/25/2022 11:11:25 AM

If you only want to check the status of recent builds, you can type Ctrl+c to get out of this interface. However, if you want detailed logs from the build, you can use the up and down arrow keys to navigate the list. When you arrive at a build you are interested in, type Enter and your logs will be displayed.

Logs

If your app only has one environment, you can execute the command:

begin logs
npx begin logs

If your app has more than one environment, you will need to specify which environment you want to get logs from:

begin logs --env staging
npx begin logs --env staging

Regardless of which of the above commands you use, you will be presented with an interface which looks like this:

❤︎ Loaded latest 'staging' logs from begin-example-app (https://local-fih.begin.app)
11/29/2022, 2:37:09 PM
some logs

11/29/2022, 2:37:11 PM
some more logs

If your logs are a bit verbose, you can always use the --filter option to only return logs that match your filter.

begin logs --env staging --filter "more"
❤︎ Loaded latest 'staging' logs from begin-example-app (https://local-fih.begin.app)
11/29/2022, 2:37:11 PM
some more logs

Note: These are the logs the server generates when your page is created. The logs include your API and page routes. For logs you output in client-side code, you’ll need to check the console in your web browser.