cli icon indicating copy to clipboard operation
cli copied to clipboard

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

Open jonleighton opened this issue 1 year ago • 8 comments

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

  • @percy/cli version: 1.28.8

jonleighton avatar Jul 04 '24 05:07 jonleighton

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.

  • "@percy/cli": "^1.28.8",
  • "storybook": "^8.1.10",

JackHowa avatar Jul 09 '24 13:07 JackHowa

This issue is stale because it has been open for more than 14 days with no activity. Remove stale label or comment or this will be closed in 14 days.

github-actions[bot] avatar Jul 23 '24 19:07 github-actions[bot]

No, still having issues

JackHowa avatar Jul 23 '24 19:07 JackHowa

This is still an issue

jonleighton avatar Jul 26 '24 05:07 jonleighton

The POST /percy/snapshot in most SDKs work async - so it instantly returns 200. If you want to only wait for asset discovery state there is currently no provision. But if you want to wait to check the result - you can use use sync flag from sdk to get the response.

ninadbstack avatar Aug 07 '24 10:08 ninadbstack

@ninadbstack thanks, yes, I want to wait for asset discovery. the sync flag (from https://github.com/percy/cli/pull/1490) appears to block on Percy actually capturing the uploaded screenshots, which is not what we want. we want to perform asset discovery, and upload the DOM/assets, then receive a response.

jonleighton avatar Aug 09 '24 06:08 jonleighton

@jonleighton Got it! Apologies for the delay, but if you need this feature please raise a support ticket with Browserstack for the same. As building it will take some time it will need to be prioritized on product roadmap.

ninadbstack avatar Aug 20 '24 14:08 ninadbstack

Gotcha thanks for the context @ninadbstack. This feels like a bug.

If issues aren't the best place to go for problems, can you put info on the Repo for best practices on reporting bugs? Thanks so much for reviewing the posts and maintaining this.

  • How to remove issues https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/enabling-features-for-your-repository/disabling-issues

JackHowa avatar Aug 20 '24 15:08 JackHowa