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

Cypress fails to parse environment variables with commas #4543

Open
Stehlert opened this issue Jun 24, 2019 · 5 comments

Comments

@Stehlert
Copy link

commented Jun 24, 2019

Current behavior:

Cypress fails to run when passing an environment variable containing a comma.

Command run:
cypress open --env ABC="1,2,3"

Stacktrace:

A JavaScript error occurred in the main process
Uncaught Exception:
TypeError: Cannot read property 'split' of undefined
at pipesToCommas (/home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/lib/util/args.js:95:14)
at JSONOrCoerce (/home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/lib/util/args.js:115:9)
at /home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/node_modules/lodash/lodash.js:13402:38
at /home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/node_modules/lodash/lodash.js:4911:15
at baseForOwn (/home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/node_modules/lodash/lodash.js:2996:24)
at Function.mapValues (/home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/node_modules/lodash/lodash.js:13401:7)
at /home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/node_modules/lodash/lodash.js:4374:28
at arrayReduce (/home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/node_modules/lodash/lodash.js:683:21)
at baseWrapperValue (/home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/node_modules/lodash/lodash.js:4373:14)
at LodashWrapper.wrapperValue (/home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/node_modules/lodash/lodash.js:9052:14)
at sanitizeAndConvertNestedArgs (/home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/lib/util/args.js:151:4)
at Object.toObject (/home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/lib/util/args.js:227:21)
at Object.start (/home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/lib/cypress.js:77:40)
at Object. (/home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/index.js:27:43)
at Object. (/home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/app/packages/server/index.js:29:3)
at Module._compile (module.js:642:30)
at Object.Module._extensions..js (module.js:653:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Module.require (module.js:586:17)
at require (internal/module.js:11:18)
at Object. (/home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/app/index.js:2:1)
at Object. (/home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/app/index.js:3:3)
at Module._compile (module.js:642:30)
at Object.Module._extensions..js (module.js:653:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Object. (/home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/electron.asar/browser/init.js:186:8)
at Object. (/home/ehlerts/.cache/Cypress/3.3.1/Cypress/resources/electron.asar/browser/init.js:188:3)
at Module._compile (module.js:642:30)
at Object.Module._extensions..js (module.js:653:10)
at Module.load (module.js:561:32)
at tryModuleLoad (module.js:504:12)
at Function.Module._load (module.js:496:3)
at Function.Module.runMain (module.js:683:10)
at startup (bootstrap_node.js:196:16)
at bootstrap_node.js:622:3

Once the stacktrace has been printed, nothing happens.

Desired behavior:

Cypress should be able to parse environment variables containing commas.

Steps to reproduce: (app code and test code)

Run the following from a terminal:

cypress open --env ABC="1,2,3"

Versions

Tested Cypress versions: 3.3.1, 3.2.0, 3.1.5
Operating system: Ubuntu 18.04.2 LTS

@jennifer-shehane

This comment has been minimized.

Copy link
Member

commented Jul 13, 2019

Confirmed, this is happening in version 3.4.0 of Cypress.

Screen Shot 2019-07-13 at 9 56 25 AM

This is the culprit line of code: https://github.com/cypress-io/cypress/blob/develop/packages/server/lib/util/args.js#L95

@sidag95

This comment has been minimized.

Copy link

commented Jul 13, 2019

@jennifer-shehane can I pick this up?

@jennifer-shehane

This comment has been minimized.

Copy link
Member

commented Jul 13, 2019

@sidag95 Sure! See our CONTRIBUTING.md in our root directory of the repo.

@sidag95

This comment has been minimized.

Copy link

commented Jul 13, 2019

Awesome will do, thanks!

@maxime1992

This comment has been minimized.

Copy link

commented Jul 29, 2019

I did something pretty silly but had this error too.

In case someone else does something similar to me I've explained it here #3742 (comment)

@sidag95 sidag95 referenced a pull request that will close this issue Aug 1, 2019
1 of 1 task complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
4 participants
You can’t perform that action at this time.