{"record":{"id":"ffb37b76757fd3dd","repo":"anomalyco/sst","slug":"request-count-scaling-is-only-supported-for-http-h","errorCode":null,"errorMessage":"Request count scaling is only supported for http/https protocols.","messagePattern":"Request count scaling is only supported for http/https protocols\\.","errorType":"validation","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/service.ts","lineNumber":1914,"sourceCode":"          securityGroups: vpc.securityGroups,\n          cloudmapNamespaceId: vpc.nodes.cloudmapNamespace.id,\n          cloudmapNamespaceName: vpc.nodes.cloudmapNamespace.name,\n        };\n      }\n\n      // \"vpc\" is object\n      return output(args.cluster.vpc).apply((vpc) => ({\n        isSstVpc: false,\n        ...vpc,\n      }));\n    }\n\n    function normalizeScaling() {\n      // External ALB is always \"application\" type\n      const lbType = albAttachment ? output(\"application\" as const) : lbArgs?.type;\n      return all([lbType, args.scaling]).apply(([type, v]) => {\n        if (type !== \"application\" && v?.requestCount)\n          throw new VisibleError(\n            `Request count scaling is only supported for http/https protocols.`,\n          );\n\n        return {\n          min: v?.min ?? 1,\n          max: v?.max ?? 1,\n          cpuUtilization: v?.cpuUtilization ?? 70,\n          memoryUtilization: v?.memoryUtilization ?? 70,\n          requestCount: v?.requestCount ?? false,\n          scaleInCooldown: v?.scaleInCooldown ? toSeconds(v.scaleInCooldown) : undefined,\n          scaleOutCooldown: v?.scaleOutCooldown ? toSeconds(v.scaleOutCooldown) : undefined,\n        };\n      });\n    }\n\n    function normalizeCapacity() {\n      if (!args.capacity) return;\n","sourceCodeStart":1896,"sourceCodeEnd":1932,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/service.ts#L1896-L1932","documentation":"Request-count-based auto scaling relies on ALB `Application` request counts per target. When the effective load balancer type is `network` (NLB) or the service has no ALB attachment, `scaling.requestCount` cannot be honored, so SST throws this `VisibleError` during normalization.","triggerScenarios":"Setting `scaling: { requestCount: ... }` on a Service whose load balancer is a network load balancer (`lbArgs.type === \"network\"`), or with an external NLB attachment.","commonSituations":"Copying an HTTP service config that used `requestCount` scaling onto a TCP/UDP (NLB) service; switching a service from http to tcp ports and keeping the scaling block.","solutions":["Remove `scaling.requestCount` and use `scaling.cpuUtilization` or `scaling.memory` for non-HTTP services.","Switch the service ports/protocol to http/https so an application LB is used and request-count scaling is valid.","If attached to an external ALB, confirm the attachment is an application-type load balancer."],"exampleFix":"// before\nscaling: { min: 1, max: 10, requestCount: 500 } // tcp service\n\n// after\nscaling: { min: 1, max: 10, cpuUtilization: 70 }","handlingStrategy":"validation","validationCode":"const isHttp = (listen: string) => /https?\\//.test(listen) || listen.endsWith(\"/http\") || listen.endsWith(\"/https\");\nif (scaling.requestCount && !usesApplicationLb) {\n  throw new Error(\"requestCount scaling requires http/https protocols\");\n}","typeGuard":"function supportsRequestCountScaling(args: { scaling?: { requestCount?: number }, protocol?: string }): boolean {\n  return !args.scaling?.requestCount || args.protocol === \"http\" || args.protocol === \"https\";\n}","tryCatchPattern":"try {\n  normalizeScalingConfig(args);\n} catch (e) {\n  if (e instanceof VisibleError && e.message.includes(\"Request count scaling\")) {\n    delete args.scaling.requestCount; // fall back to cpu/memory scaling\n  } else throw e;\n}","preventionTips":["Use `cpuUtilization`/`memory` scaling for tcp/udp services.","Reserve `requestCount` scaling for http/https listeners only.","Review scaling blocks when changing a service's protocol or LB type."],"tags":["aws","ecs","autoscaling","alb","sst"],"backgroundTag":"unsupported-scaling-configuration","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}