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

Loading chunk spec-0 failed with experimentalJustInTimeCompile #30609

Open
dfilipidisz opened this issue Nov 13, 2024 · 2 comments
Open

Loading chunk spec-0 failed with experimentalJustInTimeCompile #30609

dfilipidisz opened this issue Nov 13, 2024 · 2 comments

Comments

@dfilipidisz
Copy link

Current behavior

We started using cypress with the experimentalJustInTimeCompile flag on true, due to the frequent timeouts we were experiencing on our component testing suite.

While the original timeouts had gone away, in turn we started seeing test failures with the /__cypress/src/spec-0.js not loading in some cases. You can see more details below in logs.

The issues with spec-0.js happen on both dev laptops and CI, and does not appear to be connected to a particular test case.

Desired behavior

No test failures due to the above issue.

Test code to reproduce

Happens on whole test suite randomly, can't share it.

Cypress Version

13.5.0

Node version

20.17.0

Operating System

Ubuntu 20.04 and 22.04

Debug Logs

The following logs contains only the parts that appear to be relevant. I can't post a full one due to the sensitive data contained in it.


cypress:network:agent addRequest called { isHttps: false, href: 'http://localhost:8080/__cypress/src/spec-0.js' }
cypress:network:agent got family { family: 4, href: 'http://localhost:8080/__cypress/src/spec-0.js' }
<i> [webpack-dev-middleware] wait until bundle finished: /__cypress/src/cypress-support-file.js
<i> [webpack-dev-middleware] wait until bundle finished: /__cypress/src/spec-0.js
  Running:  redacted.cy.tsx                                       (X of Y)
cypress:server:open_project resetting project state, preparing to launch browser electron for spec {<REDACTED>}

cypress:network:agent addRequest called { isHttps: false, href: 'http://localhost:8080/__cypress/src/spec-0.js' }
cypress:network:agent got family { family: 4, href: 'http://localhost:8080/__cypress/src/spec-0.js' }
cypress:server:request received an error making http request { browserPreRequest: { requestId: '381107.85', method: 'GET', url: 'http://localhost:8080/__cypress/src/spec-0.js', headers: { 'sec-ch-ua': '"Not=A?Brand";v="99", "Chromium";v="118"', Referer: 'http://localhost:8080/__cypress/iframes/index.html?specPath=/home/davidf/redacted.cy.tsx', 'sec-ch-ua-mobile': '?0', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Cypress/13.15.0 Chrome/118.0.5993.159 Electron/27.3.10 Safari/537.36', 'sec-ch-ua-platform': '"Linux"' }, resourceType: 'xhr', originalResourceType: 'XHR', initiator: { type: 'script', stack: [Object] }, documentURL: 'http://localhost:8080/__cypress/iframes/index.html?specPath=/home/davidf/redacted.cy.tsx', hasRedirectResponse: false, cdpRequestWillBeSentTimestamp: 1731350869993.651, cdpRequestWillBeSentReceivedTimestamp: 1731350870034.6194, proxyRequestReceivedTimestamp: 1731350870000.862, cdpLagDuration: 40.968505859375, proxyRequestCorrelationDuration: 33.75732421875 }, timeout: undefined, retryIntervals: [], url: 'http://localhost:8080/__cypress/src/spec-0.js', time: false, requestId: 'request2419', retryOnNetworkFailure: true, retryOnStatusCodeFailure: false, delaysRemaining: [], err: Error: read ECONNRESET at TCP.onStreamRead (node:internal/stream_base_commons:217:20) { errno: -104, code: 'ECONNRESET', syscall: 'read' } }
2024-11-11T18:47:54.206Z cypress:server:request exhausted all attempts retrying request { browserPreRequest: { requestId: '381107.85', method: 'GET', url: 'http://localhost:8080/__cypress/src/spec-0.js', headers: { 'sec-ch-ua': '"Not=A?Brand";v="99", "Chromium";v="118"', Referer: 'http://localhost:8080/__cypress/iframes/index.html?specPath=/home/davidf/redacted.cy.tsx', 'sec-ch-ua-mobile': '?0', 'User-Agent': 'Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Cypress/13.15.0 Chrome/118.0.5993.159 Electron/27.3.10 Safari/537.36', 'sec-ch-ua-platform': '"Linux"' }, resourceType: 'xhr', originalResourceType: 'XHR', initiator: { type: 'script', stack: [Object] }, documentURL: 'http://localhost:8080/__cypress/iframes/index.html?specPath=/home/davidf/redacted.cy.tsx', hasRedirectResponse: false, cdpRequestWillBeSentTimestamp: 1731350869993.651, cdpRequestWillBeSentReceivedTimestamp: 1731350870034.6194, proxyRequestReceivedTimestamp: 1731350870000.862, cdpLagDuration: 40.968505859375, proxyRequestCorrelationDuration: 33.75732421875 }, timeout: undefined, retryIntervals: [], url: 'http://localhost:8080/__cypress/src/spec-0.js', time: false, requestId: 'request2419', retryOnNetworkFailure: true, retryOnStatusCodeFailure: false, delaysRemaining: [], err: Error: read ECONNRESET at TCP.onStreamRead (node:internal/stream_base_commons:217:20) { errno: -104, code: 'ECONNRESET', syscall: 'read' } }
cypress:server:request aborting { requestId: 'request2419' }
  1) An uncaught error was detected outside of a test

  0 passing (476ms)
  1 failing

  1) An uncaught error was detected outside of a test:
     Error: The following error originated from your test code, not from Cypress.

  > Fetching resource at '/__cypress/src/spec-0.js' failed

When Cypress detects uncaught errors originating from your test code it will automatically fail the current test.

Cypress could not associate this error to any specific test.

We dynamically generated a new test to display this failure.
      at xhr.onerror (http://localhost:8080/__cypress/runner/cypress_runner.js:111921:16)

When it doesn't fail, spec-0 is loaded correctly:

cypress:network:agent addRequest called { isHttps: false, href: 'http://localhost:8080/__cypress/src/spec-0.js' }
cypress:network:agent got family { family: 4, href: 'http://localhost:8080/__cypress/src/spec-0.js' }
cypress:server:request received status code & headers on request { requestId: 'request2403', statusCode: 200, headers: { 'content-type': 'application/javascript; charset=utf-8' } }


### Other

_No response_
@dfilipidisz dfilipidisz changed the title ChunkLoadError: Loading chunk spec-0 failed with experimentalJustInTimeCompile Loading chunk spec-0 failed with experimentalJustInTimeCompile Nov 13, 2024
@AtofStryker
Copy link
Contributor

Hi @dfilipidisz. Thank you for opening an issue. Do these timeouts also happen with experimentalJustInTimeCompile=false or does that result in a chunk load error? The behavior described almost looks similar to #15434

@dfilipidisz
Copy link
Author

Hi @dfilipidisz. Thank you for opening an issue. Do these timeouts also happen with experimentalJustInTimeCompile=false or does that result in a chunk load error? The behavior described almost looks similar to #15434

Yes, with experimentalJustInTimeCompile=false we see the random chunk load errors, that this feature flag is fixing. With experimentalJustInTimeCompile=true, we do not see the chunk load errors, but the issue with the spec-0.js file pops up.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants