cypress
cypress copied to clipboard
Errors from (fault)net::ERR_EMPTY_RESPONSE and TypeError [ERR_INVALID_HTTP_TOKEN]: Internal error during proxy
Current behavior
When I run my automation it returns an unknown error. and only in the Cypress browser on Chrome or any other it gives this error, if I log in outside of the browser that Cypress opens it opens the normal application screen.
ERROR:
GET / - - ms - -
Internal error while proxying "GET http://salesportalcli.hml.prodatamobility.com.br/" in OmitProblematicHeaders:
Header name must be a valid HTTP token ["expires "]
TypeError [ERR_INVALID_HTTP_TOKEN]: Internal error while proxying "GET http://salesportalcli.hml.prodatamobility.com.br/" in OmitProblematicHeaders:
Header name must be a valid HTTP token ["expires "]
at ServerResponse.setHeader (node:_http_outgoing:665:3)
at PatchExpressSetHeader.res.setHeader (<embedded>:4432:12149)
at N.set.N.header (<embedded>:2788:8408)
at N.set.N.header (<embedded>:2788:8448)
at Object.OmitProblematicHeaders (<embedded>:4432:12684)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at Object.next (<embedded>:4432:36627)
at Object.PatchExpressSetHeader (<embedded>:4432:12371)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at Object.next (<embedded>:4432:36627)
at Object.b (<embedded>:4414:143640)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at Object.next (<embedded>:4432:36627)
at Object.AttachPlainTextStreamFn (<embedded>:4432:11583)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at Object.next (<embedded>:4432:36627)
at Object.FilterNonProxiedResponse (<embedded>:4432:10978)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at Object.next (<embedded>:4432:36627)
at Object.LogResponse (<embedded>:4432:10577)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at A (<embedded>:4432:37153)
at <embedded>:4432:40547
at tryCatcher (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:694:18)
at _drainQueueStep (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/async.js:138:12)
at _drainQueue (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/async.js:131:9)
at Async._drainQueues (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/async.js:147:5)
at Immediate._onImmediate (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/async.js:17:14)
at process.processImmediate (node:internal/timers:476:21)
Desired behavior
You should be able to return to the login scenario without showing this error and should open the normal screen as shown in the image.
Test code to reproduce
GET / - - ms - -
Internal error while proxying "GET http://salesportalcli.hml.prodatamobility.com.br/" in OmitProblematicHeaders:
Header name must be a valid HTTP token ["expires "]
TypeError [ERR_INVALID_HTTP_TOKEN]: Internal error while proxying "GET http://salesportalcli.hml.prodatamobility.com.br/" in OmitProblematicHeaders:
Header name must be a valid HTTP token ["expires "]
at ServerResponse.setHeader (node:_http_outgoing:665:3)
at PatchExpressSetHeader.res.setHeader (<embedded>:4432:12149)
at N.set.N.header (<embedded>:2788:8408)
at N.set.N.header (<embedded>:2788:8448)
at Object.OmitProblematicHeaders (<embedded>:4432:12684)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at Object.next (<embedded>:4432:36627)
at Object.PatchExpressSetHeader (<embedded>:4432:12371)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at Object.next (<embedded>:4432:36627)
at Object.b (<embedded>:4414:143640)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at Object.next (<embedded>:4432:36627)
at Object.AttachPlainTextStreamFn (<embedded>:4432:11583)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at Object.next (<embedded>:4432:36627)
at Object.FilterNonProxiedResponse (<embedded>:4432:10978)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at Object.next (<embedded>:4432:36627)
at Object.LogResponse (<embedded>:4432:10577)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at A (<embedded>:4432:37153)
at <embedded>:4432:40547
at tryCatcher (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:694:18)
at _drainQueueStep (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/async.js:138:12)
at _drainQueue (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/async.js:131:9)
at Async._drainQueues (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/async.js:147:5)
at Immediate._onImmediate (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/async.js:17:14)
at process.processImmediate (node:internal/timers:476:21)
Cypress Version
13.6.4
Node version
v18.16.0
Operating System
macOS e ubuntu 23.10
Debug Logs
GET / - - ms - -
Internal error while proxying "GET http://salesportalcli.hml.prodatamobility.com.br/" in OmitProblematicHeaders:
Header name must be a valid HTTP token ["expires "]
TypeError [ERR_INVALID_HTTP_TOKEN]: Internal error while proxying "GET http://salesportalcli.hml.prodatamobility.com.br/" in OmitProblematicHeaders:
Header name must be a valid HTTP token ["expires "]
at ServerResponse.setHeader (node:_http_outgoing:665:3)
at PatchExpressSetHeader.res.setHeader (<embedded>:4432:12149)
at N.set.N.header (<embedded>:2788:8408)
at N.set.N.header (<embedded>:2788:8448)
at Object.OmitProblematicHeaders (<embedded>:4432:12684)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at Object.next (<embedded>:4432:36627)
at Object.PatchExpressSetHeader (<embedded>:4432:12371)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at Object.next (<embedded>:4432:36627)
at Object.b (<embedded>:4414:143640)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at Object.next (<embedded>:4432:36627)
at Object.AttachPlainTextStreamFn (<embedded>:4432:11583)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at Object.next (<embedded>:4432:36627)
at Object.FilterNonProxiedResponse (<embedded>:4432:10978)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at Object.next (<embedded>:4432:36627)
at Object.LogResponse (<embedded>:4432:10577)
at <embedded>:4432:36868
at Promise.cancellationExecute [as _execute] (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/debuggability.js:335:9)
at Promise._resolveFromExecutor (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:483:18)
at new Promise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:79:10)
at d (<embedded>:4432:35785)
at A (<embedded>:4432:37153)
at <embedded>:4432:40547
at tryCatcher (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/util.js:16:23)
at Promise._settlePromiseFromHandler (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:512:31)
at Promise._settlePromise (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:569:18)
at Promise._settlePromise0 (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:614:10)
at Promise._settlePromises (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/promise.js:694:18)
at _drainQueueStep (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/async.js:138:12)
at _drainQueue (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/async.js:131:9)
at Async._drainQueues (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/async.js:147:5)
at Immediate._onImmediate (/Users/francllinrios/Library/Caches/Cypress/13.6.4/Cypress.app/Contents/Resources/app/node_modules/bluebird/js/release/async.js:17:14)
at process.processImmediate (node:internal/timers:476:21)
Other
No response
@francllinrios Cypress has a proxy that pulls all the headers off of the requests and resets them (if needed). This erroring is surfacing that there is an invalid HTTP header since this error is being thrown when we set it from Node's https://www.geeksforgeeks.org/node-js-http-validateheadername-method/
If this is your website: http://salesportalcli.hml.prodatamobility.com.br/
, you have an invalid HTTP header that your setting and those requests will silently not go through. You need to remove the extra character in the expires
header to fix this. So this is highlighting a bug on that website.
That being said, Cypress should handle this better. Perhaps we should validate that the HTTP headers are correct before resetting them? Or just catch and ignore and errors that are thrown here? Probably second option makes more sense. https://github.com/cypress-io/cypress/blob/fix-flake-on-launchpad-ui/packages/proxy/lib/http/response-middleware.ts#L332
@jennifer-shehane Hi! After some time spent reproducing the bug i managed to do it. I can make cypress raise the error with the visit command but the request command still goes through and I'm still trying to understand why. As to the solution, i followed your suggestion and just ignored the error but shouldn't cypress inform that the header is invalid? Maybe give some type of warning in the console? I'm interested in creating a PR to fix this.
@BernardoSousa03 Yah, we should handle this better I think.
Released in 13.12.0
.
This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v13.12.0, please open a new issue.