Skip to content

Production server clogs the logs on breaking exceptions #4124

@ybnd

Description

@ybnd

Describe the bug

When server.ts encounters a breaking exception, it attempts to log a traceback showing the line where it occurred.
Because dist/server/main.js is minified basically the entire file gets printed to the log.

To Reproduce

Steps to reproduce the behavior:

  1. Add throw new Error('hello world') anywhere in the body of server.ts to simulate an uncaught error
  2. Rebuild with yarn build:prod
  3. Start with yarn serve:ssr
    • You'll see a ton of JavaScript in your log
    • There will be no way to determine what actually went wrong

Expected behavior

Logs should not be flooded this much when the production server breaks

Workaround

Disable minification in webpack.prod.ts

module.exports = Object.assign({}, commonExports, {
  ...
  optimization: {
    minimize: false,
  },
});

This may be acceptable in general, as it only affects dist/server/main.js, so we probably don't need the minimization for the space savings at least.
Not sure if there are any other performance benefits besides this.

Metadata

Metadata

Assignees

Labels

bughelp wantedNeeds a volunteer to claim to move forward

Type

Projects

Status

🏗 In Progress

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions