Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HTTP2 fetch streaming fails on cypress test run #27333

Closed
markbeaman44 opened this issue Jul 19, 2023 · 6 comments
Closed

HTTP2 fetch streaming fails on cypress test run #27333

markbeaman44 opened this issue Jul 19, 2023 · 6 comments
Labels
stale no activity on this issue for a long period type: bug

Comments

@markbeaman44
Copy link

markbeaman44 commented Jul 19, 2023

Current behavior

Our project as switched over to using http2 to take advantage of streaming - but this has had a knock on effect running the automation tests. As they fail due to net::ERR_H2_OR_QUIC_REQUIRED.

Outline:
When the body of a PUT or POST request made using fetch contains a stream (as opposed to text or a Blob) fetch requires the connection to be HTTP/2. We need to use a stream for certain endpoints so we can get an approximation of the upload progress. Initially all PUT and POST requests were made using streams and 100% of them failed in Cypress.

Workaround: We switched to only use streams when we wanted to track progress. Requests that didn't use streams then started to work because they were all downgraded to HTTP/1.1, but 20% of our tests still fail as streaming is required.

image image

Desired behavior

Automation tests to run and complete like normal

Test code to reproduce

N/A - as this is code within project

Cypress Version

12.16.0

Node version

18.15.0

Operating System

macOS 12.5.1

Debug Logs

cypress:server:socket-base backend:request { eventName: 'get:fixture', args: [ 'entity/imports/success_human UI.csv', { encoding: 'utf8' } ] } +5s
  cypress:server:fixture fixture exact name exists /Users/markbeaman/Documents/workspace/platform-e2e-tests/cypress/fixtures/entity/imports/success_human UI.csv +6m
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: 'test.platform', domain: 'bla', tld: 'com' } +2s
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: 'test.platform', domain: 'bla', tld: 'com' } +0ms
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: 'test.platform', domain: 'bla', tld: 'com' } +2ms
  cypress:server:remote-states getting remote state: { auth: null, origin: 'https://test.platform.bla.com', strategy: 'http', fileServer: null, domainName: 'bla.com', props: { port: '443', protocol: 'https:', subdomain: 'test.platform', domain: 'bla', tld: 'com' } } for: https://test.platform.bla.com/api/entities/v1/entity-imports/94d03a3e-bce1-443d-85ff-13836ab1cc1e +2s
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'bla', tld: 'com' } +0ms
  cypress:server:remote-states getting remote state: { auth: null, origin: 'https://test.platform.bla.com', strategy: 'http', fileServer: null, domainName: 'bla.com', props: { port: '443', protocol: 'https:', subdomain: 'test.platform', domain: 'bla', tld: 'com' } } for: https://bla.com +0ms
  cypress:server:stream_buffer appending chunk to buffer { bytesWritten: 0, chunkLength: 145 } +2s
  cypress:network:agent addRequest called { isHttps: true, href: 'https://test.platform.bla.com/api/entities/v1/entity-imports/94d03a3e-bce1-443d-85ff-13836ab1cc1e' } +2s
  cypress:network:agent got family { family: 4, href: 'https://test.platform.bla.com/api/entities/v1/entity-imports/94d03a3e-bce1-443d-85ff-13836ab1cc1e' } +0ms
  cypress:server:stream_buffer stream buffer writeable final called +0ms
  cypress:server:request received status code & headers on request { requestId: 'request128', statusCode: 201, headers: { 'content-type': 'application/json' } } +2s
  cypress:server:request successful response received { requestId: 'request128' } +0ms
  cypress:net-stubbing:server:intercept-response InterceptResponse { req: { url: '/api/entities/v1/entity-imports/94d03a3e-bce1-443d-85ff-13836ab1cc1e' }, request: undefined } +2s
  cypress:network:cors Parsed URL { port: '443', protocol: 'https:', subdomain: null, domain: 'bla', tld: 'com' } +145ms

Other

Looking at the debug - its not showing the request that failed - only the requests leading up to it.

@nagash77
Copy link
Contributor

Currently Cypress does not support HTTP/2. Please follow thus ticket for updates. Closing this issue as a duplicate.

@nagash77 nagash77 closed this as not planned Won't fix, can't repro, duplicate, stale Jul 19, 2023
@markbeaman44
Copy link
Author

@nagash77 I was told to create a ticket as per this comment in the ticket you mentioned: #3708 (comment)

@nagash77
Copy link
Contributor

Oh I see that @lmiller1990 suggested you log your use case where HTTP/2 was breaking your tests. Sorry for the confusion. Are you able to provide a reproducible example?

@markbeaman44
Copy link
Author

@nagash77 Sorry for the delay - it took some time to replicate it locally - please see attached.
cypress-test.zip

@cypress-app-bot
Copy link
Collaborator

This issue has not had any activity in 180 days. Cypress evolves quickly and the reported behavior should be tested on the latest version of Cypress to verify the behavior is still occurring. It will be closed in 14 days if no updates are provided.

@cypress-app-bot cypress-app-bot added the stale no activity on this issue for a long period label Jun 15, 2024
@cypress-app-bot
Copy link
Collaborator

This issue has been closed due to inactivity.

@cypress-app-bot cypress-app-bot closed this as not planned Won't fix, can't repro, duplicate, stale Jun 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stale no activity on this issue for a long period type: bug
Projects
None yet
Development

No branches or pull requests

5 participants