twilio / twilio/twilio-cli

api:core:incoming-phone-numbers:update help message displays incorrect information

Open
#255 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: medium status: help wanted triage queue type: bug
Dominant language
JavaScript
Stars
193
Forks
114
Avg merge
2d 2h
Merged PRs (30d)
7

Description

Issue Summary

If you view the help message for the api:core:incoming-phone-numbers:update command, you see the following terminal output:

--voice-method=(head|get|post|patch|put|delete)            The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`.

There are three issues here:

  1. The capitalization of the HTTP methods in the text description on the right is what the method accepts. The lowercase versions of the HTTP methods in the pseudo-call to the command, on the left, are not. It seems entirely possible to suspect that a user might only look at the pseudo example call and attempt to pass a lowercase HTTP method. If they do that they'll see the following error message printed to the console:
 » Flag value validation errors:
 »   voice-method: "post" is not one of "HEAD,GET,POST,PATCH,PUT,DELETE"
 » Cannot execute command
  1. The pseudo example call on the left lists additional HTTP methods which the option does not accept (head, patch, put, and delete).
  2. The validation error also contains more HTTP methods than the option accepts.
Steps to Reproduce
  1. Call the api:core:incoming-phone-numbers:update command and pass the --voice-fallback-method option with a lowercase HTTP method as the option's value, as in the example below.
Code Snippet
twilio api:core:incoming-phone-numbers:update \
  --sid PNb1111111111111111 \
  --voice-url "..." \
  --voice-method=post
Exception/Log
# paste exception/log here
Technical details:
  • twilio-cli version: twilio-cli/2.24.0 darwin-x64 node-v14.15.4
  • node version: v14.15.4
  • Command output with debug logging enabled (adding -l debug to the end of the command):
[DEBUG] Config File: /Users/username/.twilio-cli/config.json
[DEBUG] Using profile: username
[DEBUG] Found command "api:core:incoming-phone-numbers:update" plugin: twilio-cli
[DEBUG] Found keytar version in "@twilio/cli-core" dependencies: ^7.6.0
[DEBUG] Schema for "sid": {"maxLength":34,"minLength":34,"pattern":"^PN[0-9a-fA-F]{32}$","type":"string"}
[DEBUG] Schema for "voice-url": {"description":"The URL that we should call to answer a call to the phone number. The `voice_url` will not be called if a `voice_application_sid` or a `trunk_sid` is set.","format":"uri","type":"string"}
[DEBUG] Schema for "voice-method": {"description":"The HTTP method that we should use to call `voice_url`. Can be: `GET` or `POST` and defaults to `POST`.","enum":["HEAD","GET","POST","PATCH","PUT","DELETE"],"type":"string"}
[DEBUG] Provided flags: {"sid":"...","voice-url":"...","voice-method":"post","cli-log-level":"debug","properties":"sid,phoneNumber,friendlyName","skip-parameter-validation":false,"cli-output-format":"columns"}
 » Flag value validation errors:
 »   voice-method: "post" is not one of "HEAD,GET,POST,PATCH,PUT,DELETE"
 » Cannot execute command
[DEBUG] TwilioCliError: Cannot execute command
    at ApiCommandRunner.validateFlags (/usr/local/Cellar/twilio/2.24.0/libexec/src/services/twilio-api/api-command-runner.js:61:13)
    at ApiCommandRunner.run (/usr/local/Cellar/twilio/2.24.0/libexec/src/services/twilio-api/api-command-runner.js:24:10)
    at NewCommandClass.run (/usr/local/Cellar/twilio/2.24.0/libexec/src/base-commands/twilio-api-command.js:39:35)
    at async NewCommandClass._run (/usr/local/Cellar/twilio/2.24.0/libexec/node_modules/@oclif/command/lib/command.js:43:20)
    at async Config.runCommand (/usr/local/Cellar/twilio/2.24.0/libexec/node_modules/@oclif/config/lib/config.js:173:24)
    at async Main.run (/usr/local/Cellar/twilio/2.24.0/libexec/node_modules/@oclif/command/lib/main.js:27:9)
    at async Main._run (/usr/local/Cellar/twilio/2.24.0/libexec/node_modules/@oclif/command/lib/command.js:43:20)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the api:core:incoming-phone-numbers:update command definition and the flag-validation path shown in the debug trace, including ApiCommandRunner.validateFlags. Check how the voice-method help text and accepted values are generated. Done means the help example, description, validation error, and actual accepted methods consistently show only the supported uppercase methods.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.