Bwf/ GuideFrançais
Bwf Guide

Troubleshoot a Bwf application

Keep the terminal running bwf dev in sight while you reproduce the problem. First we need to know whether the build stopped or the running server received a request.

Check whether the server started

Look for Bwf listening in the terminal. If the build stopped before that message, start with the first error and the file it names. If the server is listening, repeat the request so you can inspect its status and headers.

Express error handling

Find the PostgreSQL used by this run

If the error names postgres, initdb and pg_ctl, find the directory containing all three and set BWF_PG_BIN to that directory. If PostgreSQL starts but a query fails to check, look at the schema produced by the migrations. For an error after startup, use the migration ledger below to see what the database at DATABASE_URL has actually applied.

Use this query to see which migration files that database has recorded.

psql "$DATABASE_URL" -c 'SELECT name FROM bwf_migrations ORDER BY name'

Read the method, path and Allow

Try GET and POST on / in a new starter. GET returns 200. POST returns 405 and its Allow header lists GET and HEAD. Now request a missing page and a missing stylesheet. Both give 404, but the next place to look differs. For a page, find the path in openapi.yaml. For an asset, find the file under static/ in the server’s working directory.

In the Journal, this POST should also give 405. A 403 after a local POST is a reason to check the session and CSRF token. With 422, compare the submitted fields to the schema and the action’s validation.

curl -si -X POST http://127.0.0.1:18088/healthz

Check the handshake in the browser

Look for the subscription marker and the client script in the page. In the Network panel, inspect the WebSocket handshake and its subscription frames. If those are present, check whether a database trigger ran and whether the write committed. The connection can be quiet when the rendered HTML hasn’t changed.

Compare the response headers to this upgrade.

HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade

Try the Journal locally

Open the Journal chapter