{"record":{"id":"5b57ed5ce81cef48","repo":"anomalyco/sst","slug":"result-errors-join-n","errorCode":null,"errorMessage":"result.errors.join(\"\\n\")","messagePattern":"result\\.errors\\.join\\(\"\\\\n\"\\)","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"platform/src/components/aws/function.ts","lineNumber":2105,"sourceCode":"      return Link.getInclude<Permission>(\"aws.permission\", args.link);\n    }\n\n    function buildHandler() {\n      return all([runtime, dev, isContainer]).apply(\n        async ([runtime, dev, isContainer]) => {\n          if (dev) {\n            return resolveDevBridge();\n          }\n\n          const buildResult = buildInput.apply(async (input) => {\n            const result = await rpc.call<{\n              handler: string;\n              out: string;\n              errors: string[];\n              sourcemaps: string[];\n            }>(\"Runtime.Build\", { ...input, isContainer });\n            if (result.errors.length > 0) {\n              throw new Error(result.errors.join(\"\\n\"));\n            }\n            if (args.hook?.postbuild) await args.hook.postbuild(result.out);\n            return result;\n          });\n\n          return {\n            handler: buildResult.handler,\n            bundle: buildResult.out,\n            sourcemaps: buildResult.sourcemaps,\n          };\n\n          function resolveDevBridge() {\n            if (durable) {\n              return {\n                handler: \"index.handler\",\n                bundle: path.join($cli.paths.platform, \"dist\", \"nodejs-bridge\"),\n                sourcemaps: undefined,\n              };","sourceCodeStart":2087,"sourceCodeEnd":2123,"githubUrl":"https://github.com/anomalyco/sst/blob/a0bd20f762883e72a35caccb4896c42ce5b3f707/platform/src/components/aws/function.ts#L2087-L2123","documentation":"buildHandler() invokes the embedded Go runtime via the \"Runtime.Build\" RPC, which returns an errors array for esbuild/bundling problems. If any errors are reported, they are joined and thrown as a single Error — this is the bundler failure message you see in your terminal.","triggerScenarios":"Any bundling error: TypeScript type-independent syntax errors, unresolved imports, missing node_modules, bad loader configuration, or invalid entrypoints/handler paths passed to the esbuild build inside the runtime.","commonSituations":"Importing a package that isn't installed; typo'd relative import path; using Node APIs not available in the target; monorepo path alias not configured in build args.","solutions":["Read the joined error lines above the throw — they contain the esbuild file/line diagnostics","Install missing dependencies (bun install / npm install)","Fix or remove the import path reported in the first error line","Run `sst dev` locally to iterate on the bundle quickly"],"exampleFix":"// before (handler.ts)\nimport { helper } from \"./helpr\"; // typo\n// after\nimport { helper } from \"./helper\";","handlingStrategy":"try-catch","validationCode":"// pre-check imports resolve before build\nimport fs from \"fs\";\nconst entry = \"src/index.ts\";\nif (!fs.existsSync(entry)) throw new Error(`Handler entry not found: ${entry}`);","typeGuard":null,"tryCatchPattern":"try {\n  const result = await fnHandlerBuild(input);\n} catch (e) {\n  const lines = (e as Error).message.split(\"\\n\");\n  console.error(\"esbuild errors:\", lines); // first line names file + position\n  process.exit(1);\n}","preventionTips":["Run sst dev locally before deploying to surface bundle errors fast","Ensure all imports are installed and paths/aliases resolve","Keep handler entrypoints syntactically valid; run tsc --noEmit in CI"],"tags":["aws","lambda","esbuild","bundling","build-error"],"backgroundTag":"bundle-build-failed","analyzedSha":"a0bd20f762883e72a35caccb4896c42ce5b3f707","analyzedAt":"2026-08-30T11:26:00.383Z","schemaVersion":2},"datasetVersion":"2026-08-30T13:17:10.514Z"}