Skip to content

Conversation

@isoos
Copy link
Collaborator

@isoos isoos commented Mar 28, 2025

Fixes #8673.

@isoos isoos requested review from jonasfj and sigurdm March 28, 2025 09:52
Dockerfile.app Outdated
ENV PUB_CACHE="/project/.pub-cache"
# Let the pub server know that it is running inside a container.
# It will not rebuild web-app assets, only assert their presence.
ENV PUB_DEV_IN_CONTAINER="1"
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
ENV PUB_DEV_IN_CONTAINER="1"
ENV PUB_DEV_ENVIRONMENT="production"

I think that's a better indicator, or even just ENVIRONMENT=production.

Future<void> assertExists(String path) async {
final file = File(path);
if (!file.existsSync()) {
throw AssertionError('`$path`` is missing.');
Copy link
Member

Choose a reason for hiding this comment

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

Will this prevent startup?

We could opt to make the build fail, if they are not present, and just serve empty file or 404s if they are requested and not present.

Along with shouting in logs at startup, on the other hand crashing when not present is very reliable :D

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It will throw in the HTTP frontend isolate, before the HTTP server is up and with that AppEngine will surely kill it. Though, you are right, it may not be a good idea, instead, we should serve 404 + shout in the logs. The current way this is is implemented will look like the build succeeded, but serving will never happen. I'll redo this.

@isoos
Copy link
Collaborator Author

isoos commented May 2, 2025

Closing in favor of #8729

@isoos isoos closed this May 2, 2025
@isoos isoos deleted the built-assert branch May 2, 2025 08:08
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.

Production server startup should fail if built resources are not present

3 participants