Closed Nutcracker52 closed 5 months ago
@Nutcracker52 what is the value of validateUrl
when this error occurs? I'm guessing it contains some special characters that we aren't handling correctly in the internal HTTP file server.
@Nutcracker52 what is the value of
validateUrl
when this error occurs? I'm guessing it contains some special characters that we aren't handling correctly in the internal HTTP file server.
I can confirm at least special characters in paths can cause this problem.
I cloned easy-markdown-editor in a folder, which has an ancestor folder called Umaĵo
, and this error occurred when I tried run its tests. after renaming the folder from Umaĵo
to Umajho
, that error goes away.
(OS: macOS 12.6.3; cypress version: 10.11.0)
@umajho, I attempted a recreation here: https://github.com/mjhenkes/issue-25839 but i think my one test is too simplistic.
Which tests do you see failing in easy-markdown-editor?
Cypress just exited while running the first test it picked.
sh-3.2$ mkdir Umaĵo
sh-3.2$ cd Umaĵo/
sh-3.2$ git clone https://github.com/Ionaru/easy-markdown-editor
Cloning into 'easy-markdown-editor'...
remote: Enumerating objects: 6994, done.
remote: Counting objects: 100% (1074/1074), done.
remote: Compressing objects: 100% (410/410), done.
remote: Total 6994 (delta 718), reused 970 (delta 649), pack-reused 5920
Receiving objects: 100% (6994/6994), 12.56 MiB | 1.92 MiB/s, done.
Resolving deltas: 100% (3073/3073), done.
sh-3.2$ cd easy-markdown-editor/
sh-3.2$ pnpm i
WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
Packages: +732
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Packages are hard linked from the content-addressable store to the virtual store.
Content-addressable store is at: /Users/xxx/Library/pnpm/store/v3
Virtual store is at: node_modules/.pnpm
Progress: resolved 730, reused 730, downloaded 0, added 732, done
> easymde@2.18.0 prepare /private/tmp/Umaĵo/easy-markdown-editor
> gulp
[14:43:28] Using gulpfile /private/tmp/Umaĵo/easy-markdown-editor/gulpfile.js
[14:43:28] Starting 'default'...
[14:43:28] Starting 'styles'...
[14:43:28] Starting 'lint'...
[14:43:28] Finished 'lint' after 485 ms
[14:43:28] Starting 'scripts'...
[14:43:29] Finished 'styles' after 548 ms
[14:43:31] Finished 'scripts' after 2.84 s
[14:43:31] Finished 'default' after 3.33 s
dependencies:
+ @types/codemirror 5.60.7
+ @types/marked 4.0.8
+ codemirror 5.65.12 (6.0.1 is available)
+ codemirror-spell-checker 1.1.2
+ marked 4.2.12
devDependencies:
+ browserify 17.0.0
+ cypress 10.11.0 (12.8.0 is available)
+ eslint 8.36.0
+ eslint-plugin-cypress 2.12.1
+ gulp 4.0.2
+ gulp-clean-css 4.3.0
+ gulp-concat 2.6.1
+ gulp-eslint 6.0.0
+ gulp-header 2.0.9
+ gulp-rename 2.0.0
+ gulp-terser 2.1.0
+ gulp-uglify 3.0.2
+ typescript 4.9.5
+ vinyl-buffer 1.0.1
+ vinyl-source-stream 2.0.0
Done in 23.7s
sh-3.2$ pnpm run cypress:run
> easymde@2.18.0 cypress:run /private/tmp/Umaĵo/easy-markdown-editor
> cypress run
Couldn't find tsconfig.json. tsconfig-paths will be skipped
====================================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 10.11.0 │
│ Browser: Electron 106 (headless) │
│ Node Version: v19.7.0 (/usr/local/Cellar/node/19.7.0/bin/node) │
│ Specs: 5 found (2-url-prompt/url-prompt.cy.js, 1-default-editor/preview.cy.js, 1-defa │
│ ult-editor/statusbar.cy.js, 1-default-editor/visual.cy.js, 3-class-prefix/clas │
│ s-prefix.cy.js) │
│ Searched: cypress/e2e/**/*.cy.{js,jsx,ts,tsx} │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: 2-url-prompt/url-prompt.cy.js (1 of 5)
URL prompts
Invalid character in header content ["x-cypress-file-path"]
TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["x-cypress-file-path"]
at ServerResponse.setHeader (node:_http_outgoing:579:3)
at onRequest (/Users/xxx/Library/Caches/Cypress/10.11.0/Cypress.app/Contents/Resources/app/packages/server/lib/file_server.js:37:7)
at Server.<anonymous> (/Users/xxx/Library/Caches/Cypress/10.11.0/Cypress.app/Contents/Resources/app/packages/server/lib/file_server.js:57:16)
at Server.emit (node:events:527:28)
at Server.emit (node:domain:475:12)
at parserOnIncoming (node:_http_server:956:12)
at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
ELIFECYCLE Command failed with exit code 1.
sh-3.2$
another try:
sh-3.2$ pnpm run cypress:run
> easymde@2.18.0 cypress:run /private/tmp/Umaĵo/easy-markdown-editor
> cypress run
Couldn't find tsconfig.json. tsconfig-paths will be skipped
====================================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 10.11.0 │
│ Browser: Electron 106 (headless) │
│ Node Version: v19.7.0 (/usr/local/Cellar/node/19.7.0/bin/node) │
│ Specs: 5 found (1-default-editor/preview.cy.js, 1-default-editor/statusbar.cy.js, 1-d │
│ efault-editor/visual.cy.js, 2-url-prompt/url-prompt.cy.js, 3-class-prefix/clas │
│ s-prefix.cy.js) │
│ Searched: cypress/e2e/**/*.cy.{js,jsx,ts,tsx} │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: 1-default-editor/preview.cy.js (1 of 5)
Preview
Invalid character in header content ["x-cypress-file-path"]
TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["x-cypress-file-path"]
at ServerResponse.setHeader (node:_http_outgoing:579:3)
at onRequest (/Users/xxx/Library/Caches/Cypress/10.11.0/Cypress.app/Contents/Resources/app/packages/server/lib/file_server.js:37:7)
at Server.<anonymous> (/Users/xxx/Library/Caches/Cypress/10.11.0/Cypress.app/Contents/Resources/app/packages/server/lib/file_server.js:57:16)
at Server.emit (node:events:527:28)
at Server.emit (node:domain:475:12)
at parserOnIncoming (node:_http_server:956:12)
at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
ELIFECYCLE Command failed with exit code 1.
sh-3.2$
Updating cypress to the latest version doesn't work as well:
sh-3.2$ pnpm up cypress --latest
WARN deprecated chokidar@2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
Packages: +1 -1
+-
Progress: resolved 730, reused 730, downloaded 0, added 1, done
devDependencies:
- cypress 10.11.0
+ cypress 12.8.0
Done in 7.5s
sh-3.2$ pnpm run cypress:run
> easymde@2.18.0 cypress:run /private/tmp/Umaĵo/easy-markdown-editor
> cypress run
It looks like this is your first time using Cypress: 12.8.0
✔ Verified Cypress! /Users/xxx/Library/Caches/Cypress/12.8.0/Cypress.app
Opening Cypress...
Couldn't find tsconfig.json. tsconfig-paths will be skipped
====================================================================================================
(Run Starting)
┌────────────────────────────────────────────────────────────────────────────────────────────────┐
│ Cypress: 12.8.0 │
│ Browser: Electron 106 (headless) │
│ Node Version: v19.7.0 (/usr/local/Cellar/node/19.7.0/bin/node) │
│ Specs: 5 found (1-default-editor/preview.cy.js, 1-default-editor/statusbar.cy.js, 1-d │
│ efault-editor/visual.cy.js, 2-url-prompt/url-prompt.cy.js, 3-class-prefix/clas │
│ s-prefix.cy.js) │
│ Searched: cypress/e2e/**/*.cy.{js,jsx,ts,tsx} │
└────────────────────────────────────────────────────────────────────────────────────────────────┘
────────────────────────────────────────────────────────────────────────────────────────────────────
Running: 1-default-editor/preview.cy.js (1 of 5)
Preview
Invalid character in header content ["x-cypress-file-path"]
TypeError [ERR_INVALID_CHAR]: Invalid character in header content ["x-cypress-file-path"]
at ServerResponse.setHeader (node:_http_outgoing:579:3)
at g (<embedded>:4721:1236)
at Server.<anonymous> (<embedded>:4721:1875)
at Server.emit (node:events:527:28)
at parserOnIncoming (node:_http_server:956:12)
at HTTPParser.parserOnHeadersComplete (node:_http_common:128:17)
ELIFECYCLE Command failed with exit code 1.
sh-3.2$
I'm hoping to give @mjhenkes 's repro a shot hopefully next week trying to run these tests with a different language configured in a ubuntu VM, or a special character in a folder name being used.
@mjhenkes I wasn't able to reproduce with your reprod but I was able to reproduce with easy-markdown-editor
inside an ubuntu VM with the directory with a special character. I could not reproduce without the special character in the directory. I am going to go ahead and route this since we can reproduce the issue
I had the same error, it turned out I forgot to initialize the environment variables on the command line that are used in cypress.config.ts
I had the same error
In my case, it happened in the process of loading the local html file.
I didn't understand exactly why, I found out that the src path of the img tag was caused by getting it from the assets folder, and the image file was named Korean.
The test could be executed normally by solving as follows.
Before
<img
src="./assets/image/coffee/제주_비저링_콜드_브루.jpeg"
width="200"
height="200"
/>
After
<img
src="./assets/image/coffee/coffee1.jpeg"
width="200"
height="200"
/>
You can check this PR https://github.com/function-and-mountain/functional-coding-nutshell/pull/12
If somebody still faces such issue, solution might be to encode url, before giving it to Cypress. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/encodeURI
Released in 13.10.0
.
This comment thread has been locked. If you are still experiencing this issue after upgrading to Cypress v13.10.0, please open a new issue.
Current behavior
https://github.com/cypress-io/cypress/issues/25273 related to this closed issue and I can confirm this is happening and it's pretty annyoing.
Error Code pops
test I am trying to run
I am reading emails from an API and check that email has been received and then email contains a link and click that link
Desired behavior
Cypress shouldn't throw any errors while test is running. This completely crashes Cypress and I have to run tests again.
To avoid the error I had to add cy.visit command as first line to the code. which is not necessary.
Test code to reproduce
please use the given code above. get email is a function that we designed to get emails from an api. I cannot share it.
Cypress Version
8.3.1
Node version
16.19.0
Operating System
Windows 11
Debug Logs
No response
Other
No response