`POST /percy/snapshot` API - Error during asset discovery not reported
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/cliversion: 1.28.8
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",
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.
No, still having issues
This is still an issue
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 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 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.
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