percy / cli

The Percy CLI is used to interact with, and upload snapshots to, percy.io via the command line.
https://docs.percy.io/docs/cli-overview
67 stars 40 forks source link

`POST /percy/snapshot` API - Error during asset discovery not reported #1649

Open jonleighton opened 5 days ago

jonleighton commented 5 days ago

The problem

We are uploading snapshots via a manual POST /percy/snapshot API request, within a percy exec invocation.

Sometimes, there is an error during asset discovery, and we see the following log lines:

2024-07-04 10:04:12 AEST    [percy] asset-discovery - [snapshot name] - 30.013s
2024-07-04 10:04:12 AEST    [percy] Encountered an error taking snapshot: [snapshot name]
2024-07-04 10:04:12 AEST    [percy] Error: Navigation failed: Timed out waiting for the page load event

However, the POST /percy/snapshot request returns a 200 OK response, with {"success": true} in the body. Therefore our build succeeds, even though the snapshot failed, and there is no way for us to detect the problem.

I would expect a 500 Internal Server Error response in this situation, and possibly some details in the response body.

Environment

JackHowa commented 5 hours ago

Possibly seeing a similar issue:

[percy:core:queue] Clearing discovery queue, queued state: 0, pending state: 0 (15ms)
[percy:core:browser] Closing browser (1ms)
[percy:core:browser] Browser closed (18ms)
[percy:core:queue] Clearing snapshot queue, queued state: 0, pending state: 0 (1ms)
[percy:core] Build not created (0ms)
[percy:cli] Error: Protocol error (Runtime.callFunctionOn): Execution context was destroyed.