serverless/serverless · error · ServerlessError
DOMAIN_CONFIG_AMBIGUOUS_BOOLEAN
DOMAIN_CONFIG_AMBIGUOUS_BOOLEAN
Error message
${Globals.pluginName}: Ambiguous boolean config: "${value}" What it means
Thrown by evaluateBoolean when a custom-domains boolean config field (enabled, createRoute53Record, createRoute53IPv6Record, autoDomain, preserveExternalPathMappings, splitHorizonDns) is set to a value that is not undefined and does not stringify to true/1/false/0. The function accepts booleans and the strings 'true','1','false','0' (case-insensitive, trimmed) and rejects everything else.
Source
Thrown at packages/serverless/lib/plugins/aws/domains/utils.js:38
* @param {boolean|string} value the config value provided
* @param {boolean} defaultValue the default value to return, if config value is undefined
* @returns {boolean} the parsed boolean from the config value, or the default value
*/
function evaluateBoolean(value, defaultValue) {
if (value === undefined) {
return defaultValue
}
const s = value.toString().toLowerCase().trim()
const trueValues = ['true', '1']
const falseValues = ['false', '0']
if (trueValues.indexOf(s) >= 0) {
return true
}
if (falseValues.indexOf(s) >= 0) {
return false
}
throw new ServerlessError(
`${Globals.pluginName}: Ambiguous boolean config: "${value}"`,
ServerlessErrorCodes.domains.DOMAIN_CONFIG_AMBIGUOUS_BOOLEAN,
)
}
/**
* Iterate through the pages of an AWS SDK v3 response and collect them into a single array
*
* @param {Object} client - The AWS SDK v3 client instance
* @param {string} resultsKey - The key name in the response that contains the items to return
* @param {string} nextTokenKey - The request key name to append to the request that has the paging token value
* @param {string} nextResponseTokenKey - The response key name that has the next paging token value
* @param {Object} command - The AWS SDK v3 Command instance to execute
* @returns {Promise<Array>} Promise that resolves to an array of results
*/
async function getAWSPagedResults(
client,
resultsKey,View on GitHub (pinned to b9d7ea51c8)
Solutions
- Use YAML booleans (true/false) or the digits 1/0.
- Remove the key to accept its documented default (each field has its own default).
- If the value comes from a variable, ensure the resolver yields true/false rather than a word.
Example fix
# before customDomains: - enabled: 'yes' # after customDomains: - enabled: true
Defensive patterns
Strategy: validation
Validate before calling
const BOOL_KEYS = ['enabled', 'createRoute53Record', 'createRoute53IPv6Record', 'autoDomain', 'preserveExternalPathMappings', 'splitHorizonDns']
function isValidBool(v) {
if (v === undefined) return true
return ['true', '1', 'false', '0'].includes(String(v).toLowerCase().trim())
}
function validateDomainBools(domain) {
return BOOL_KEYS.every((k) => isValidBool(domain[k]))
} Type guard
function isParseableBoolean(v) {
return v === undefined || typeof v === 'boolean' || ['true','1','false','0'].includes(String(v).toLowerCase().trim())
} Prevention
- Prefer YAML booleans (true/false) over strings for boolean fields.
- Never use yes/no/on/off for these fields; they are not accepted by this parser.
- If values come from a resolver, assert the resolved type is boolean in tests.
When it happens
Trigger: Setting a boolean field to 'yes', 'no', 'on', 'off', 'enabled', 'Y', 'N', or any non-zero number like 2.
Common situations: Using YAML barewords yes/no/on/off that a stricter loader leaves as strings; passing a free-form truthy string; confusing this plugin's strict parser with another tool's lenient one.
Related errors
- DOMAIN_CONFIG_INVALID_ACCESS_MODE
- DOMAIN_CONFIG_INVALID_ROUTING_POLICY
- DOMAIN_CONFIG_ROUTING_POLICY_EDGE_INCOMPATIBLE
- AWS_ROUTE53_MISSING_HOSTED_ZONE
- NO_AGENTS_DEFINED
AI-assisted analysis of serverless/serverless@b9d7ea51c8 (2026-08-13).
Data as JSON: /api/errors/4209b5b386daaf81.
Report an issue: GitHub.