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

TypeError: Cannot convert undefined or null to object when empty options are set in a command under tooling #240

Closed
kaszarobert opened this issue Oct 22, 2024 · 2 comments · Fixed by #248
Assignees
Labels
bug Something isn't working

Comments

@kaszarobert
Copy link

Just updated to v3.22.3 and I noticed one regression in the Landofile when specifying custom commands under tooling. This was valid before:

tooling:
  phpcs:
    service: appserver
    cmd: "/app/vendor/bin/phpcs --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md"
    options:
    description: Run phpcs for given folder or file.
  phpcbf:
    service: appserver
    cmd: "/app/vendor/bin/phpcbf --standard=Drupal,DrupalPractice --extensions=php,module,inc,install,test,profile,theme,css,info,txt,md"
    options:
    description: Run phpcs for given folder or file.

But now, it throws an error until I remove the line with the empty options:

/snapshot/cli/node_modules/yargs/build/lib/yargs.js:1132
                throw err;
                ^

TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at builder (/snapshot/cli/lib/cli.js)
    at Object.runCommand (/snapshot/cli/node_modules/yargs/build/lib/command.js:152:35)
    at Object.parseArgs [as _parseArgs] (/snapshot/cli/node_modules/yargs/build/lib/yargs.js:1043:55)
    at Function.get [as argv] (/snapshot/cli/node_modules/yargs/build/lib/yargs.js:986:25)
    at Cli.init (/snapshot/cli/lib/cli.js)
    at Cli.run (/snapshot/cli/lib/cli.js)
    at Object.<anonymous> (/snapshot/cli/bin/lando)
    at Module._compile (pkg/prelude/bootstrap.js:1930:22)
    at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)

Node.js v18.19.1

The documentation page also shows examples where it seems an empty option key is valid:
https://docs.lando.dev/core/v3/tooling.html#usage
https://docs.lando.dev/core/v3/tooling.html#overriding

@kaszarobert kaszarobert added the bug Something isn't working label Oct 22, 2024
@pirog pirog self-assigned this Oct 23, 2024
@pirog
Copy link
Member

pirog commented Oct 23, 2024

@kaszarobert i cannot replicate this. what are you doing/running to see the error? can you share your full landofile?

@pirog
Copy link
Member

pirog commented Oct 23, 2024

nevermind! was able to replicate!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants