fix: Handle large payloads sent with privileged commands #27122
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Additional details
Running a privileged command with a large payload can cause a
413 Request Entity Too Large
error in express/body-parser when on thePOST /__cypress/add-verified-command
request.This is experienced with the code coverage plugin since it sends the entire coverage payload through
cy.task()
.The crux of the issue is that privileged commands send their args to the server via a POST request when the command is invoked (i.e. enqueued, before being run), which triggers the 413 error in express/body-parser. Those args are compared later when the command is actually run. The fix is to send a hashed version of each arg instead of sending the entire arg in order to reduce the payload size. Then when the command is run, hashes are compared instead of full values.
Steps to test
someTask
implementation incypress.config.js
. Doesn't actually need to do anything besidesreturn null
.How has the user experience changed?
PR Tasks
cypress-documentation
?type definitions
?