#6993·sst

svelte-kit-sst incompatible with SvelteKit 3 — Lambda handler imports removed @sveltejs/kit/node/polyfills export

Author: AlperSakaryaCreated Aug 30, 2026Updated Aug 30, 2026

Description

Deploying a SvelteKit app with sst.aws.SvelteKit fails during the Lambda function bundling step. The svelte-kit-sst adapter's generated Lambda handler imports @sveltejs/kit/node/polyfills, but that subpath export was removed in SvelteKit 3, so the bundler cannot resolve it.

The two core issues:

  1. The adapter declares @sveltejs/kit ^1.5.0 ([email protected]), and its shipped handler (dist/handler/index.js, copied to .svelte-kit/svelte-kit-sst/server/lambda-handler/index.js) does:

    javascript
    import { installPolyfills } from "@sveltejs/kit/node/polyfills";
    // ...
    installPolyfills();
  2. SvelteKit 3 removed ./node/polyfills from its export map. Installed @sveltejs/[email protected] exposes:

    ".", "./internal", "./internal/env", "./internal/types", "./internal/server",
    "./adapter", "./node", "./hooks", "./env", "./params", "./vite"

    ./node exists, but ./node/polyfills does not.

Error

Error: Could not resolve "@sveltejs/kit/node/polyfills" .svelte-kit/svelte-kit-sst/server/lambda-handler/index.js:3:33
    at .../.sst/platform/src/components/aws/function.ts:2105:21

References

  • SvelteKit 3 migration guide — @sveltejs/kit/node/polyfills (removed): https://next.svelte.dev/docs/kit/migrating-to-sveltekit-3

    The @sveltejs/kit/node/polyfills module (and the Node global shims in adapter-node and adapter-netlify) applied to Node versions that are no longer supported. Remove any import '@sveltejs/kit/node/polyfills' statements from your custom server code.

  • Same guide states "All first-party adapters now require SvelteKit 3", with per-adapter migration steps — a third-party adapter like svelte-kit-sst needs equivalent updates.
  • Historical origin of the module: sveltejs/kit PR #4934 "Node polyfills" ("replace @sveltejs/kit/install-fetch with @sveltejs/kit/node/polyfills").

Additional adapter-API breakage against Kit 3

Beyond the fatal import, the adapter's adapt() (dist/index.js) uses builder methods that the migration guide lists as deprecated in Kit 3 in favour of node:fs:

javascript
builder.rimraf(out);
builder.mkdirp(clientDir);

builder.mkdirp and builder.rimraf are deprecated in favour of node:fs methods.

(These are only deprecations today, but signal the adapter predates the Kit 3 adapter API.)

Notes

  • vite build / the adapter's adapt() step succeeds because it only copies the prewritten handler files — it does not bundle them. Resolution fails later, when SST bundles the Lambda function, which is where the deploy aborts.
  • The deploy is left partially applied — asset files, CloudWatch log group, server IAM role, and the API gateway are created before the error.

Environment

Package Version
sst 4.17.1
svelte-kit-sst 2.43.5
@sveltejs/kit 3.0.0-next.25
@sveltejs/vite-plugin-svelte 7.3.0
svelte 5.57.0
vite 8.2.2
Node 22.14.0
OS Linux

Expected

Either svelte-kit-sst is updated for SvelteKit 3 (drop the installPolyfills import; adopt the current adapter API), or the docs/adapter declare a supported SvelteKit version range so sst.aws.SvelteKit builds don't fail at deploy time.