{"record":{"id":"4209b5b386daaf81","repo":"serverless/serverless","slug":"domain-config-ambiguous-boolean","errorCode":"DOMAIN_CONFIG_AMBIGUOUS_BOOLEAN","errorMessage":"${Globals.pluginName}: Ambiguous boolean config: \"${value}\"","messagePattern":"(.+?): Ambiguous boolean config: \"(.+?)\"","errorType":"exception","errorClass":"ServerlessError","httpStatus":null,"severity":"error","filePath":"packages/serverless/lib/plugins/aws/domains/utils.js","lineNumber":38,"sourceCode":" * @param {boolean|string} value the config value provided\n * @param {boolean} defaultValue the default value to return, if config value is undefined\n * @returns {boolean} the parsed boolean from the config value, or the default value\n */\nfunction evaluateBoolean(value, defaultValue) {\n  if (value === undefined) {\n    return defaultValue\n  }\n\n  const s = value.toString().toLowerCase().trim()\n  const trueValues = ['true', '1']\n  const falseValues = ['false', '0']\n  if (trueValues.indexOf(s) >= 0) {\n    return true\n  }\n  if (falseValues.indexOf(s) >= 0) {\n    return false\n  }\n  throw new ServerlessError(\n    `${Globals.pluginName}: Ambiguous boolean config: \"${value}\"`,\n    ServerlessErrorCodes.domains.DOMAIN_CONFIG_AMBIGUOUS_BOOLEAN,\n  )\n}\n\n/**\n * Iterate through the pages of an AWS SDK v3 response and collect them into a single array\n *\n * @param {Object} client - The AWS SDK v3 client instance\n * @param {string} resultsKey - The key name in the response that contains the items to return\n * @param {string} nextTokenKey - The request key name to append to the request that has the paging token value\n * @param {string} nextResponseTokenKey - The response key name that has the next paging token value\n * @param {Object} command - The AWS SDK v3 Command instance to execute\n * @returns {Promise<Array>} Promise that resolves to an array of results\n */\nasync function getAWSPagedResults(\n  client,\n  resultsKey,","sourceCodeStart":20,"sourceCodeEnd":56,"githubUrl":"https://github.com/serverless/serverless/blob/b9d7ea51c8cce57cff1207964b9b71123673081f/packages/serverless/lib/plugins/aws/domains/utils.js#L20-L56","documentation":"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.","triggerScenarios":"Setting a boolean field to 'yes', 'no', 'on', 'off', 'enabled', 'Y', 'N', or any non-zero number like 2.","commonSituations":"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.","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."],"exampleFix":"# before\ncustomDomains:\n  - enabled: 'yes'\n# after\ncustomDomains:\n  - enabled: true","handlingStrategy":"validation","validationCode":"const BOOL_KEYS = ['enabled', 'createRoute53Record', 'createRoute53IPv6Record', 'autoDomain', 'preserveExternalPathMappings', 'splitHorizonDns']\nfunction isValidBool(v) {\n  if (v === undefined) return true\n  return ['true', '1', 'false', '0'].includes(String(v).toLowerCase().trim())\n}\nfunction validateDomainBools(domain) {\n  return BOOL_KEYS.every((k) => isValidBool(domain[k]))\n}","typeGuard":"function isParseableBoolean(v) {\n  return v === undefined || typeof v === 'boolean' || ['true','1','false','0'].includes(String(v).toLowerCase().trim())\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["domains","config-validation","boolean","parsing"],"backgroundTag":null,"analyzedSha":"b9d7ea51c8cce57cff1207964b9b71123673081f","analyzedAt":"2026-08-13T04:14:40.386Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}