anomalyco/sst · error · VisibleError
No AWS-Lambda preset detected for TanStack Start. Add the n
Error message
No AWS-Lambda preset detected for TanStack Start.
Add the nitro preset to your `vite.config.ts`:
// vite.config.ts
import { nitro } from "nitro/vite"
export default defineConfig({
server: {
preset: "aws-lambda",
},
});
Detected preset: "${nitro.preset ?? "undefined"}" What it means
SST's `TanStackStart` component deploys the app as a Nitro AWS Lambda function, so the build output (`.output/nitro.json`) must report the `aws-lambda` preset. In `buildPlan` (platform/src/components/aws/tan-stack-start.ts:359), when the detected preset differs and the project root contains a `vite.config.ts`/`vite.config.js` (Nitro/Vite-style project), SST throws this VisibleError telling you to set the preset in `vite.config.ts`.
Source
Thrown at platform/src/components/aws/tan-stack-start.ts:375
protected normalizeBuildCommand() { }
protected buildPlan(outputPath: Output<string>): Output<Plan> {
return outputPath.apply((outputPath) => {
const nitro = JSON.parse(
fs.readFileSync(
path.join(outputPath, ".output", "nitro.json"),
"utf-8",
),
);
if (!["aws-lambda"].includes(nitro.preset)) {
const projectRoot = path.dirname(outputPath);
const isViteProject =
fs.existsSync(path.join(projectRoot, "vite.config.ts")) ||
fs.existsSync(path.join(projectRoot, "vite.config.js"));
if (isViteProject) {
throw new VisibleError(
[
"No AWS-Lambda preset detected for TanStack Start.",
"",
"Add the nitro preset to your `vite.config.ts`:",
" // vite.config.ts",
' import { nitro } from "nitro/vite"',
"",
" export default defineConfig({",
" plugins: [nitro(), tanstackStart(), ...],",
" nitro: {",
' preset: "aws-lambda",',
" awsLambda: { streaming: true }, // optional",
" },",
" });",
"",
`Detected preset: "${nitro.preset ?? "undefined"}"`,
].join("\n"),
);View on GitHub (pinned to a0bd20f762)
Solutions
- Add `import { nitro } from "nitro/vite"` and configure `nitro: { preset: "aws-lambda" }` in `vite.config.ts`, then rebuild and redeploy.
- Optionally enable streaming with `nitro: { preset: "aws-lambda", awsLambda: { streaming: true } }`.
- Verify the fix by checking that `.output/nitro.json` in the build output reports `"preset": "aws-lambda"` before deploying.
Example fix
// before (vite.config.ts)
import { defineConfig } from "vite";
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
export default defineConfig({ plugins: [tanstackStart()] });
// after
import { defineConfig } from "vite";
import { nitro } from "nitro/vite";
import { tanstackStart } from "@tanstack/react-start/plugin/vite";
export default defineConfig({
plugins: [nitro(), tanstackStart(), ...],
nitro: { preset: "aws-lambda" },
}); Defensive patterns
Strategy: validation
Validate before calling
import fs from "node:fs";
const nitro = JSON.parse(fs.readFileSync(".output/nitro.json", "utf-8"));
if (nitro.preset !== "aws-lambda")
throw new Error(`Set nitro preset to "aws-lambda" (got: ${nitro.preset ?? "undefined"})`); Type guard
null
Try / catch
// VisibleError aborts the Pulumi deploy rather than a call you can wrap;
// guard at build time instead:
import { execSync } from "node:child_process";
execSync("npm run build");
const nitro = JSON.parse(require("fs").readFileSync(".output/nitro.json", "utf-8"));
if (nitro.preset !== "aws-lambda") process.exit(1); Prevention
- Always configure `nitro: { preset: "aws-lambda" }` in vite.config.ts for SST deployments.
- After a local build, check `.output/nitro.json` reports `"preset": "aws-lambda"` before running `sst deploy`.
- Keep the nitro vite plugin ordered before tanstackStart in the plugins array.
- Don't rely on NITRO_PRESET env vars alone; set the preset in config so it lands in nitro.json.
When it happens
Trigger: Running `sst deploy` for a TanStack Start app whose `vite.config.ts` exists but whose Nitro config does not set `nitro.preset` (or sets it to something other than `"aws-lambda"`), so the built `.output/nitro.json` has `preset: undefined` or another value.
Common situations: Scaffolding a new TanStack Start app with `tanstackStart()` but no nitro plugin options; upgrading TanStack Start to the Vite/Nitro pipeline and missing the preset migration; setting the preset only in a `.env` or CLI flag that isn't reflected in `nitro.json`.
Related errors
- No AWS-Lambda preset detected for TanStack Start. Update yo
- SolidStart's app.config.ts must be configured to use the "aw
- TanStack Start build output not found in "${path.resolve(out
- TanStack Start assets directory not found at: "${path.reso
- You cannot provide both "job" and "function" in the "${name}
AI-assisted analysis of anomalyco/sst@a0bd20f762 (2026-08-30).
Data as JSON: /api/errors/b452e9c5dbf1c792.
Report an issue: GitHub.