Skip to content

Warn when server binary is built without web assets#445

Merged
ptone merged 2 commits into
GoogleCloudPlatform:mainfrom
ptone:scion/web-assets-warning
Jun 18, 2026
Merged

Warn when server binary is built without web assets#445
ptone merged 2 commits into
GoogleCloudPlatform:mainfrom
ptone:scion/web-assets-warning

Conversation

@ptone

@ptone ptone commented Jun 18, 2026

Copy link
Copy Markdown
Member

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>

It's a good idea to open an issue first for discussion.

  • Tests pass
  • Appropriate changes to documentation are included in the PR

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.
@google-cla

google-cla Bot commented Jun 18, 2026

Copy link
Copy Markdown

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.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread cmd/server_foreground.go Outdated
Comment on lines +333 to +334
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.")

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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.
@ptone ptone merged commit 62d6274 into GoogleCloudPlatform:main Jun 18, 2026
2 of 5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant