{"record":{"id":"b7cd76eafbd31468","repo":"anomalyco/sst","slug":"the-namespaceid-property-must-be-a-positive-inte","errorCode":null,"errorMessage":"The `namespaceId` property must be a positive integer.","messagePattern":"The `namespaceId` property must be a positive integer\\.","errorType":"validation","errorClass":"VisibleError","httpStatus":null,"severity":"error","filePath":"platform/src/components/cloudflare/rate-limit.ts","lineNumber":98,"sourceCode":"  constructor(\n    name: string,\n    args: RateLimitArgs,\n    opts?: ComponentResourceOptions,\n  ) {\n    super(__pulumiType, name, args, opts);\n\n    const namespaceId = normalizeNamespaceId();\n    const limit = output(args.limit);\n    const period = normalizePeriod();\n\n    this._namespaceId = namespaceId;\n    this._limit = limit;\n    this._period = period;\n\n    function normalizeNamespaceId() {\n      return output(args.namespaceId).apply((namespaceId) => {\n        if (!Number.isInteger(namespaceId) || namespaceId <= 0) {\n          throw new VisibleError(\n            \"The `namespaceId` property must be a positive integer.\",\n          );\n        }\n\n        return namespaceId.toString();\n      });\n    }\n\n    function normalizePeriod() {\n      return output(args.period).apply(toSeconds);\n    }\n  }\n\n  /**\n   * A unique identifier for the rate limit namespace.\n   */\n  public get namespaceId() {\n    return this._namespaceId;","sourceCodeStart":80,"sourceCodeEnd":116,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/cloudflare/rate-limit.ts#L80-L116","documentation":"`sst.cloudflare.RateLimit` requires `namespaceId` to be a positive integer because it maps to a Cloudflare rate-limit binding namespace id (a numeric string at the API boundary). Non-integer, zero, or negative values are rejected at synth time.","triggerScenarios":"Passing `namespaceId: 0`, a negative number, a decimal like `1.5`, or a value that isn't a number at all (e.g. a string) to the RateLimit component's `args.namespaceId`.","commonSituations":"Hardcoded placeholder `0` left in config; copying a Cloudflare dashboard value that includes characters; constructing the id from env vars that resolve to undefined/NaN.","solutions":["Set `namespaceId` to the positive integer id from your Cloudflare rate-limit binding configuration","If sourcing from an env var, parse and validate: `Number.isInteger(Number(id)) && Number(id) > 0` before passing","Remove placeholder values like 0 left from templates"],"exampleFix":"// before\nnew sst.cloudflare.RateLimit('RL', { namespaceId: 0 });\n// after\nnew sst.cloudflare.RateLimit('RL', { namespaceId: 42 });","handlingStrategy":"validation","validationCode":"const id = Number(process.env.RATE_LIMIT_NS_ID);\nif (!Number.isInteger(id) || id <= 0) throw new Error(`namespaceId must be a positive integer, got: ${id}`);\nnew sst.cloudflare.RateLimit('RL', { namespaceId: id });","typeGuard":"function isPositiveInt(v: unknown): v is number {\n  return typeof v === 'number' && Number.isInteger(v) && v > 0;\n}","tryCatchPattern":"// synth-time VisibleError\ntry {\n  const rl = new sst.cloudflare.RateLimit('RL', { namespaceId: cfg.namespaceId });\n} catch (e) {\n  console.error('Invalid namespaceId:', e.message);\n}","preventionTips":["Copy namespace ids exactly from Cloudflare (numbers only)","Validate any env-var-sourced id with Number.isInteger and > 0","Never leave placeholder values like 0 in config"],"tags":["cloudflare","configuration","validation","rate-limit"],"backgroundTag":"invalid-config-value","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}