sveltejs/kit · warning
Could not detect a supported production environment. See htt
Error message
Could not detect a supported production environment. See https://svelte.dev/docs/kit/adapters to learn how to configure your app to run on the platform of your choosing
What it means
adapter-auto's `adapt` step could not identify the hosting platform from environment variables and no suitable adapter is installed. The build succeeds, but no server output suited to production is produced, and this warning explains how to pick an adapter.
Source
Thrown at packages/adapter-auto/index.js:147
return {
...adapter,
adapt: (builder) => {
builder.log.info(`Detected environment: ${match.name}. Using ${match.module}`);
return adapter.adapt(builder);
}
};
}
/** @type {typeof import('./index.js').default} */
export default () => ({
name: '@sveltejs/adapter-auto',
adapt: async (builder) => {
const adapter = await get_adapter();
if (adapter) return adapter.adapt(builder);
builder.log.warn(
'Could not detect a supported production environment. See https://svelte.dev/docs/kit/adapters to learn how to configure your app to run on the platform of your choosing'
);
},
supports: {
read: () => {
supports_error(
'The read function imported from $app/server only works in certain environments'
);
},
instrumentation: () => {
supports_error('`instrumentation.server.js` only works in certain environments');
}
}
});
/**
* @param {string} message
* @returns {never}View on GitHub (pinned to 03f1687fe6)
Solutions
- Install and configure the adapter for your target, e.g. `@sveltejs/adapter-node` for self-hosting
- Keep adapter-auto only if you deploy exclusively to a detected platform
- Check CI env vars — the platform's variables must be present for auto-detection
Example fix
// svelte.config.js before import adapter from '@sveltejs/adapter-auto'; // after import adapter from '@sveltejs/adapter-node';
Defensive patterns
Strategy: validation
Validate before calling
// fail fast if relying on auto-detection without platform env vars
const detected = ['VERCEL', 'NETLIFY', 'CLOUDFLARE', 'FLY_APP_NAME'].some((v) => process.env[v]);
if (!detected) console.warn('adapter-auto will not detect a platform; configure an explicit adapter'); Prevention
- Choose an explicit adapter matching your hosting target
- Don't use adapter-auto for Docker/self-hosted builds
- Ensure CI exposes platform env vars if you rely on auto-detection
When it happens
Trigger: Running a production build on a machine/CI with none of the detected platform env vars (VERCEL, NETLIFY, CLOUDFULARE, etc.) and no explicit adapter in svelte.config.js; `get_adapter()` resolves to undefined.
Common situations: Building a Docker image or self-hosted server while still using adapter-auto; deploying to a platform adapter-auto doesn't recognize; local builds meant to test production output.
Related errors
- ${message}. Since you're using @sveltejs/adapter-auto, Svelt
- Cloudflare Pages' _routes.json should be configured from the
- If you plan to continue deploying to ${match.name}, conside
- Could not resolve peer dependency "${name}" relative to your
- Could not find valid "${subpackage}" export in ${name}/packa
AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02).
Data as JSON: /api/errors/9f0a4c9516f978e5.
Report an issue: GitHub.