Warn when server binary is built without web assets#445
Conversation
Add a prominent startup warning when web assets are not embedded and no --web-assets-dir is provided. Serve the self-contained noAssetsPage HTML from the static asset handler instead of a plain text 404, so direct requests to /assets/* also show a helpful message.
|
Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). View this failed invocation of the CLA check for more information. For the most up to date status, view the checks section at the bottom of the pull request. |
There was a problem hiding this comment.
Code Review
This pull request adds a warning when the server is started without web assets and updates the static asset handler to serve a user-friendly HTML page instead of a plain text error when assets are missing. The reviewer suggested using structured logging (slog.Warn) instead of standard log.Printf to ensure warnings are correctly formatted in production environments.
| log.Printf("WARNING: This binary was built without web assets. The web UI will not be available.") | ||
| log.Printf("Run 'make web' and rebuild to include the web frontend, or use --web-assets-dir.") |
There was a problem hiding this comment.
The application is configured to use structured logging via slog (which supports GCP logging format, OTel, etc.). Using standard log.Printf bypasses the structured logging handler, meaning these warnings won't be correctly formatted as structured JSON logs in production/hosted environments. Consider using slog.Warn instead to ensure the warning is properly captured by the configured logging pipeline.
| log.Printf("WARNING: This binary was built without web assets. The web UI will not be available.") | |
| log.Printf("Run 'make web' and rebuild to include the web frontend, or use --web-assets-dir.") | |
| slog.Warn("This binary was built without web assets. The web UI will not be available. Run 'make web' and rebuild to include the web frontend, or use --web-assets-dir.") |
Switch from log.Printf to slog.Warn so the warning formats correctly in structured logging environments.
Add a prominent startup warning when web assets are not embedded and no --web-assets-dir is provided. Serve the self-contained noAssetsPage HTML from the static asset handler instead of a plain text 404, so direct requests to /assets/* also show a helpful message.
Fixes #<issue_number_goes_here>