Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Jun 4, 2025

The webpack build errors in the GDU package were not being properly displayed in the console due to incorrect promise resolution logic in runWebpack.ts.

The Problem

The run function in /packages/gdu/lib/runWebpack.ts had a race condition where:

  1. compiler.run() would execute and receive compilation errors
  2. compiler.close() would be called, and its callback would immediately resolve the promise
  3. The done() function would then try to reject the promise, but it was already resolved

This meant that webpack compilation errors were silently swallowed and never displayed to developers.

The Solution

Fixed the promise resolution flow by:

  1. Moving error handling inside the close callback: The done(resolve, reject) call now happens inside the compiler.close() callback, ensuring errors are handled before the promise is settled
  2. Adding explicit error logging: Enhanced the done function to log compilation errors to the console using console.error() before rejecting
  3. Proper error combination: Compilation errors (err) and close errors (err2) are now properly combined

Before

compiler.run((err, stats) => {
    compiler.close((err2) => {
        resolve(err || err2); // Promise resolved immediately!
    });
    done(resolve, reject); // This rejection has no effect
});

After

compiler.run((err, stats) => {
    compiler.close((err2) => {
        const combinedError = err || err2;
        done(resolve, reject)(combinedError, stats); // Proper error handling
    });
});

Now webpack compilation errors will be clearly visible in the console with detailed error messages, making debugging much easier for developers.

Fixes #331.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • http://168.63.129.16:80/machine/
    • Triggering command: /usr/bin/python3 -u bin/WALinuxAgent-2.13.1.1-py3.9.egg -collect-logs (http block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI changed the title [WIP] Errors from the GDU Webpack build are not visisble in the console Fix webpack error handling in GDU build process Jun 4, 2025
Copilot AI requested a review from skinread June 4, 2025 05:06
Copilot finished work on behalf of skinread June 4, 2025 05:06
Copilot finished work on behalf of skinread June 4, 2025 05:40
Copy link
Contributor

@skinread skinread left a comment

Choose a reason for hiding this comment

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

Make sure to generate a change set for GDU so that it is versioned.
The CI uses changeset library

Copy link
Contributor Author

Copilot AI commented Jun 4, 2025

Make sure to generate a change set for GDU so that it is versioned.
The CI uses changeset library

Added changeset for GDU package in commit 9a3db28. The changeset will ensure proper versioning when the webpack error handling fix is released.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • http://168.63.129.16:80/machine/
    • Triggering command: /usr/bin/python3 -u bin/WALinuxAgent-2.13.1.1-py3.9.egg -collect-logs (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot finished work on behalf of skinread June 4, 2025 05:50
@skinread skinread marked this pull request as ready for review June 4, 2025 05:52
@skinread skinread requested a review from a team as a code owner June 4, 2025 05:52
@skinread skinread self-requested a review June 4, 2025 05:53
@amir-zahedi amir-zahedi deleted the copilot/fix-331 branch September 24, 2025 01:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Errors from the GDU Webpack build are not visisble in the console

3 participants