You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On a fresh install, any Worker that constructs an AWS SDK v3 client (e.g. new DynamoDBClient({})) throws at runtime in vite dev:
[vite] Internal server error: (0 , __vite_ssr_import_5__.emitWarningIfUnsupportedVersion) is not a function
at getRuntimeConfig (node_modules/@aws-sdk/client-dynamodb/dist-es/runtimeConfig.js:18:5)
at new DynamoDBClient (node_modules/@aws-sdk/client-dynamodb/dist-es/DynamoDBClient.js:20:27)
at Object.fetch (worker/index.ts)
The Worker's Vite environment runs @aws-sdk/* / @smithy/* through the SSR module runner, and it cannot resolve named re-exports that pass through the subpath-barrel entrypoints (@aws-sdk/core/client, @smithy/core/client) introduced in the current AWS SDK generation — the binding comes back undefined.
Reproduction
Worker entry:
import{DynamoDBClient}from'@aws-sdk/client-dynamodb';exportdefault{asyncfetch(){newDynamoDBClient({region: 'us-east-1'});// throws during constructionreturnnewResponse('ok');},};
package.json (fresh install today resolves the broken generation):
@smithy/smithy-client@4.14.6 does the same via @smithy/core/client. The Worker environment's SSR runner resolves emitWarningIfUnsupportedVersion off that re-export chain as undefined, so calling it throws.
This is the downstream effect of an intentional AWS change — aws/aws-sdk-js-v3#7686 (v3.974.0, "Changes to AWS SDK internal package dependency version pinning"), which AWS closed as working-as-intended ("No changes are needed by AWS SDK users"). Because AWS declares every internal dep with ^caret ranges, a fresh install always floats the entire @aws-sdk/* + @smithy/* tree into this generation.
The previous generation resolves fine (@aws-sdk/core@3.973.27, @smithy/smithy-client@4.12.9), because those define the exports locally / via relative paths rather than through the subpath barrel.
What I tried (workarounds that do NOT work)
environments.<worker>.optimizeDeps.include: ['@aws-sdk/client-dynamodb', '@aws-sdk/lib-dynamodb']
→ pre-bundles a standalone @aws-sdk_client-dynamodb.js (esbuild does resolve the barrel there), but the actual importer keeps its own copy and still throws.
Pin the whole @aws-sdk/* + @smithy/* tree back to the last pre-3.974 generation via resolutions (yarn) / overrides (npm/pnpm). Pinning a single package skews (the newer middleware re-export from the newer @aws-sdk/core/client), so the entire generation must be pinned together.
Expected
The Worker environment's dep optimizer / SSR runner should resolve named re-exports through AWS SDK v3's subpath-barrel entrypoints, so the current (default-installed) AWS SDK works in vite dev without version pinning.
Which Cloudflare product(s)?
@cloudflare/vite-pluginSummary
On a fresh install, any Worker that constructs an AWS SDK v3 client (e.g.
new DynamoDBClient({})) throws at runtime invite dev:The Worker's Vite environment runs
@aws-sdk/*/@smithy/*through the SSR module runner, and it cannot resolve named re-exports that pass through the subpath-barrel entrypoints (@aws-sdk/core/client,@smithy/core/client) introduced in the current AWS SDK generation — the binding comes backundefined.Reproduction
Worker entry:
package.json(fresh install today resolves the broken generation):wrangler.jsonc:"compatibility_flags": ["nodejs_compat"],"compatibility_date": "2026-03-10".Hit the Worker once → 500 with the error above.
Environment
@cloudflare/vite-plugin: 1.43.2 (also repro on 1.41.0)Root cause
AWS reorganized the SDK internals so that top-level entrypoints re-export through subpath barrels. Example — installed
@aws-sdk/core@3.974.29:@smithy/smithy-client@4.14.6does the same via@smithy/core/client. The Worker environment's SSR runner resolvesemitWarningIfUnsupportedVersionoff that re-export chain asundefined, so calling it throws.This is the downstream effect of an intentional AWS change — aws/aws-sdk-js-v3#7686 (v3.974.0, "Changes to AWS SDK internal package dependency version pinning"), which AWS closed as working-as-intended ("No changes are needed by AWS SDK users"). Because AWS declares every internal dep with
^caretranges, a fresh install always floats the entire@aws-sdk/*+@smithy/*tree into this generation.The previous generation resolves fine (
@aws-sdk/core@3.973.27,@smithy/smithy-client@4.12.9), because those define the exports locally / via relative paths rather than through the subpath barrel.What I tried (workarounds that do NOT work)
environments.<worker>.optimizeDeps.include: ['@aws-sdk/client-dynamodb', '@aws-sdk/lib-dynamodb']→ pre-bundles a standalone
@aws-sdk_client-dynamodb.js(esbuild does resolve the barrel there), but the actual importer keeps its own copy and still throws.include: ['use-dynamodb > @aws-sdk/client-dynamodb']→ no effect (looks like
ssr.optimizeDeps.includewithdep1 > dep2syntax not working vitejs/vite#16405 —dep1 > dep2not honored in the SSR/Worker environment).optimizeDeps.exclude/resolve.external→ rejected as incompatible with@cloudflare/vite-plugin(@cloudflare/vite-plugindoesn't allowoptimizeDeps.excludefor framework packages to avoid being optimized #9538).Current workaround
Pin the whole
@aws-sdk/*+@smithy/*tree back to the last pre-3.974 generation viaresolutions(yarn) /overrides(npm/pnpm). Pinning a single package skews (the newer middleware re-export from the newer@aws-sdk/core/client), so the entire generation must be pinned together.Expected
The Worker environment's dep optimizer / SSR runner should resolve named re-exports through AWS SDK v3's subpath-barrel entrypoints, so the current (default-installed) AWS SDK works in
vite devwithout version pinning.Related
ssr.optimizeDeps.includewithdep1 > dep2syntax not working vitejs/vite#16405 (dep1 > dep2include not working)@cloudflare/vite-plugindoesn't allowoptimizeDeps.excludefor framework packages to avoid being optimized #9538 (optimizeDeps.excludeincompatible with the plugin)