Skip to content

aio runtime ip-list get --region is case-sensitive and errors on uppercase region values #425

@pru55e11

Description

@pru55e11

Summary

The new aio runtime ip-list get command treats the --region flag as case-sensitive. Passing an uppercase (or mixed-case) region value such as AUS fails with an invalid region error, even though the same value in lowercase (aus) works fine. This is surprising because the command's own output prints region names in uppercase (e.g. AUS (3 CIDRs)), so users naturally copy that casing back into the flag.

Steps to reproduce

$ aio runtime ip-list get --region AUS
CLIError: invalid region "AUS". Expected one of: amer, emea, apac, aus
    at IpListGet.run (.../@adobe/aio-cli-plugin-runtime/src/commands/runtime/ip-list/get.js:235:12)
$ aio runtime ip-list get --region aus   # works
Adobe I/O Runtime egress IPs
...
AUS  (3 CIDRs)
  13.210.83.241/32
  13.238.35.162/32
  15.136.156.143/32

Expected behavior

Either:

  1. Accept both cases — normalize the flag value (e.g. lowercase it) before validation so AUS, Aus, and aus are all accepted. This is the friendliest option and matches the uppercase casing the command itself prints.

    and/or

  2. Print a friendlier error — if case-sensitivity is intentional, the error message should hint that regions are lowercase, e.g. invalid region "AUS". Did you mean "aus"? Expected one of: amer, emea, apac, aus.

Root cause

The validation in src/commands/runtime/ip-list/get.js compares the raw flag value against the lowercase VALID_REGIONS array without normalizing case:

const VALID_REGIONS = ['amer', 'emea', 'apac', 'aus']
// ...
if (flags.region && !VALID_REGIONS.includes(flags.region)) {
  this.error(`invalid region "${flags.region}". Expected one of: ${VALID_REGIONS.join(', ')}`, { exit: 1 })
}

Suggested fix

Lowercase the flag value before validating and sending it to the service, for example:

const region = flags.region && flags.region.toLowerCase()
if (region && !VALID_REGIONS.includes(region)) {
  this.error(`invalid region "${flags.region}". Expected one of: ${VALID_REGIONS.join(', ')}`, { exit: 1 })
}
// ...use `region` for the downstream getIpList() calls

Environment

  • Node.js v24.14.1
  • Reproduced via @adobe/aio-cli-plugin-runtime (aio runtime ip-list get)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions