@astrojs/netlify
8.2.14 · 13 Nov 2026MIT71.2k / weekRepositoryHomepagenpmAtom feed
151 stable releases, newest first, by release line. Notes are quoted as the maintainers published them.
- 6.x
6.5.3
23 Jul 2025Adds mock feature flags in dev
Patch Changes
Adds mock feature flags in dev
6.5.2
21 Jul 2025Upgrades Netlify Vite plugin to fix error in edge functions.
Patch Changes
Upgrades Netlify Vite plugin to fix error in edge functions.
6.5.1
16 Jul 2025Fixes a bug that caused remote images to sometimes not display correctly when using the Netlify Image CDN in local dev
Adds a new
devFeaturesconfiguration option to control some of the behaviors introduced in@astrojs/netlify@6.5.0, which introduced Netlify production features into the dev environment.You can now individually configure whether or not to populate your environment with the variables from your linked Netlify site (now disabled by default), and use a local version of the Netlify Image CDN for images (still enabled by default) when running
astro dev.Additionally, the adapter no longer injects environment variables from Netlify by default when running
astro dev.@astrojs/netlify@6.5.0introduced a potentially breaking change that enabled injecting Netlify environment variables inastro devby default. This could lead to unexpected behavior in Astro projects that do not expect these variables to be present. This now defaults to disabled, and users can enable it by setting thedevFeatures.environmentVariablesoption in their Astro config. Similarly, you can usedevFeatures.imagesto disable using the Netlify Image CDN locally if needed:import { defineConfig } from 'astro/config'; import netlify from '@astrojs/netlify'; export default defineConfig({ adapter: netlify({ devFeatures: { environmentVariables: true, images: false, }, }), });You can also set
devFeaturestotrueorfalseto enable or disable all configurable dev features:import { defineConfig } from 'astro/config'; import netlify from '@astrojs/netlify'; export default defineConfig({ adapter: netlify({ devFeatures: true, }), });
Patch Changes
Fixes a bug that caused remote images to sometimes not display correctly when using the Netlify Image CDN in local dev
Adds a new
devFeaturesconfiguration option to control some of the behaviors introduced in@astrojs/netlify@6.5.0, which introduced Netlify production features into the dev environment.You can now individually configure whether or not to populate your environment with the variables from your linked Netlify site (now disabled by default), and use a local version of the Netlify Image CDN for images (still enabled by default) when running
astro dev.Additionally, the adapter no longer injects environment variables from Netlify by default when running
astro dev.@astrojs/netlify@6.5.0introduced a potentially breaking change that enabled injecting Netlify environment variables inastro devby default. This could lead to unexpected behavior in Astro projects that do not expect these variables to be present. This now defaults to disabled, and users can enable it by setting thedevFeatures.environmentVariablesoption in their Astro config. Similarly, you can usedevFeatures.imagesto disable using the Netlify Image CDN locally if needed:import { defineConfig } from 'astro/config'; import netlify from '@astrojs/netlify'; export default defineConfig({ adapter: netlify({ devFeatures: { environmentVariables: true, images: false, }, }), });You can also set
devFeaturestotrueorfalseto enable or disable all configurable dev features:import { defineConfig } from 'astro/config'; import netlify from '@astrojs/netlify'; export default defineConfig({ adapter: netlify({ devFeatures: true, }), });
6.5.0
14 Jul 2025Updates the adapter to use Netlify's Vite plugin in development.
Minor Changes
Updates the adapter to use Netlify's Vite plugin in development.
This is an implementation update that does not require any change to your project code, but means that
astro devwill run with an environment closer to a production deploy on Netlify. This brings several benefits you'll now notice working in dev mode!For example, your project running in development mode will now use local versions of the Netlify Image CDN for images, and a local Blobs server for sessions. It will also populate your environment with the variables from your linked Netlify site.
While not required for fully static, prerendered web sites, you may still wish to add this for the additional benefits of now working in a dev environment closer to your Netlify production deploy, as well as to take advantage of Netlify-exclusive features such as the Netlify Image CDN.
6.4.1
3 Jul 2025Fixes the internal implementation of the new feature
experimentalStaticHeaders, where dynamic routes
were mapped to use always the same header.
Patch Changes
Fixes the internal implementation of the new feature
experimentalStaticHeaders, where dynamic routes
were mapped to use always the same header.
6.4.0
17 Jun 2025Adds support for the experimental static headers Astro feature.
When the feature is enabled via option
experimentalStaticHeaders, and experimental Content Security Policy is enabled, the adapter will generateResponseheaders for static pages, which allows support for CSP directives that are not supported inside a<meta>tag (e.g.frame-ancestors).import { defineConfig } from 'astro/config'; import netlify from '@astrojs/netlify'; export default defineConfig({ adapter: netlify({ experimentalStaticHeaders: true, }), experimental: { cps: true, }, });
Minor Changes
Adds support for the experimental static headers Astro feature.
When the feature is enabled via option
experimentalStaticHeaders, and experimental Content Security Policy is enabled, the adapter will generateResponseheaders for static pages, which allows support for CSP directives that are not supported inside a<meta>tag (e.g.frame-ancestors).import { defineConfig } from 'astro/config'; import netlify from '@astrojs/netlify'; export default defineConfig({ adapter: netlify({ experimentalStaticHeaders: true, }), experimental: { cps: true, }, });
6.3.4
21 May 2025Fixes an issue where the adapter didn't take into consideration the
outDirconfiguration.Fixes an issue with SVGs not rendering with image-cdn enabled, due to invalid source path parsing.
Patch Changes
Fixes an issue where the adapter didn't take into consideration the
outDirconfiguration.Fixes an issue with SVGs not rendering with image-cdn enabled, due to invalid source path parsing.
6.3.3
13 May 2025Unify imported images detection across adapters
Patch Changes
Unify imported images detection across adapters
6.3.2
30 Apr 2025Update vite to latest version for fixing CVE
Patch Changes
Update vite to latest version for fixing CVE
6.3.1
23 Apr 2025Removes unused code
Patch Changes
Removes unused code
6.3.0
15 Apr 2025The experimental session API introduced in Astro 5.1 is now stable and ready for production use.
Sessions are used to store user state between requests for on-demand rendered pages. You can use them to store user data, such as authentication tokens, shopping cart contents, or any other data that needs to persist across requests:
--- export const prerender = false; // Not needed with 'server' output const cart = await Astro.session.get('cart'); --- <a href="/checkout">🛒 {cart?.length ?? 0} items</a>
Minor Changes
The experimental session API introduced in Astro 5.1 is now stable and ready for production use.
Sessions are used to store user state between requests for on-demand rendered pages. You can use them to store user data, such as authentication tokens, shopping cart contents, or any other data that needs to persist across requests:
--- export const prerender = false; // Not needed with 'server' output const cart = await Astro.session.get('cart'); --- <a href="/checkout">🛒 {cart?.length ?? 0} items</a>
Configuring session storage
Sessions require a storage driver to store the data. The Node, Cloudflare and Netlify adapters automatically configure a default driver for you, but other adapters currently require you to specify a custom storage driver in your configuration. If you are using an adapter that doesn't have a default driver, or if you want to choose a different driver, you can configure it using the `session` configuration option: ```js import { defineConfig } from 'astro/config'; import vercel from '@astrojs/vercel'; export default defineConfig({ adapter: vercel(), session: { driver: 'upstash', }, }); ```Using sessions
Sessions are available in on-demand rendered pages, API endpoints, actions and middleware. In pages and components, you can access the session using `Astro.session`: ```astro --- const cart = await Astro.session.get('cart'); --- <a href="/checkout">🛒 {cart?.length ?? 0} items</a> ``` In endpoints, actions, and middleware, you can access the session using `context.session`: ```js export async function GET(context) { const cart = await context.session.get('cart'); return Response.json({ cart }); } ``` If you attempt to access the session when there is no storage driver configured, or in a prerendered page, the session object will be `undefined` and an error will be logged in the console: ```astro --- export const prerender = true; const cart = await Astro.session?.get('cart'); // Logs an error. Astro.session is undefined --- ```Upgrading from Experimental to Stable
If you were previously using the experimental API, please remove the `experimental.session` flag from your configuration: ```diff import { defineConfig } from 'astro/config'; import node from '@astrojs/node'; export default defineConfig({ adapter: node({ mode: "standalone", }), - experimental: { - session: true, - }, }); ``` See [the sessions guide](https://docs.astro.build/en/guides/sessions/) for more information.6.2.6
14 Apr 2025Update vite to latest version to fix CVE
Updates vite to the latest version
Patch Changes
Update vite to latest version to fix CVE
Updates vite to the latest version
6.2.5
31 Mar 2025Update
viteto the latest version
Patch Changes
Update
viteto the latest version
6.2.4
26 Mar 2025Updates the dependency
viteto the latest.
Patch Changes
Updates the dependency
viteto the latest.
6.2.3
11 Mar 2025Only updates dependencies:@astrojs/internal-helpers 0.6.1@astrojs/underscore-redirects 0.6.0
6.2.2
27 Feb 2025Updates
esbuildandviteto the latest to avoid false positives audits warnings caused byesbuild.
Patch Changes
Updates
esbuildandviteto the latest to avoid false positives audits warnings caused byesbuild.
6.2.1
24 Feb 2025Uses
tinyglobbyfor globbing files
Patch Changes
Uses
tinyglobbyfor globbing files
6.2.0
13 Feb 2025Adds
includedFilesandexcludedFilesconfiguration options to customize SSR function bundle contents.The
includeFilesproperty allows you to explicitly specify additional files that should be bundled with your function. This is useful for files that aren't automatically detected as dependencies, such as:Similarly, you can use the
excludeFilesproperty to prevent specific files from being bundled that would otherwise be included. This is helpful for:import { defineConfig } from 'astro/config'; import netlify from '@astrojs/netlify'; export default defineConfig({ // ... output: 'server', adapter: netlify({ includeFiles: ['./my-data.json'], excludeFiles: ['./node_modules/package/**/*', './src/**/*.test.js'], }), });See the Netlify adapter documentation for detailed usage instructions and examples.
Automatically configures Netlify Blobs storage when experimental session enabled
If the
experimental.sessionflag is enabled when using the Netlify adapter, Astro will automatically configure the session storage using the Netlify Blobs driver. You can still manually configure the session storage if you need to use a different driver or want to customize the session storage configuration.See the experimental session docs for more information on configuring session storage.
Minor Changes
Adds
includedFilesandexcludedFilesconfiguration options to customize SSR function bundle contents.The
includeFilesproperty allows you to explicitly specify additional files that should be bundled with your function. This is useful for files that aren't automatically detected as dependencies, such as:Data files loaded using
fsoperationsConfiguration files
Template files
Similarly, you can use the
excludeFilesproperty to prevent specific files from being bundled that would otherwise be included. This is helpful for:Reducing bundle size
Excluding large binaries
Preventing unwanted files from being deployed
import { defineConfig } from 'astro/config'; import netlify from '@astrojs/netlify'; export default defineConfig({ // ... output: 'server', adapter: netlify({ includeFiles: ['./my-data.json'], excludeFiles: ['./node_modules/package/**/*', './src/**/*.test.js'], }), });See the Netlify adapter documentation for detailed usage instructions and examples.
Automatically configures Netlify Blobs storage when experimental session enabled
If the
experimental.sessionflag is enabled when using the Netlify adapter, Astro will automatically configure the session storage using the Netlify Blobs driver. You can still manually configure the session storage if you need to use a different driver or want to customize the session storage configuration.See the experimental session docs for more information on configuring session storage.
6.1.0
13 Jan 2025Stabilizes
astro:envsecrets supportImproves Astro 5 support
Refactor of the redirects logic
6.0.1
16 Dec 2024Fixes an error where edge middleware would incorrectly assign locals
Correctly pass Netlify context in edge middleware
6.0.0
3 Dec 2024- Breaking
Removed support for the Squoosh image service. As the underlying library
libsquooshis no longer maintained, and the image service sees very little usage we have decided to remove it from Astro.Our recommendation is to use the base Sharp image service, which is more powerful, faster, and more actively maintained.
- import { squooshImageService } from "astro/config"; import { defineConfig } from "astro/config"; export default defineConfig({ - image: { - service: squooshImageService() - } });If you are using this service, and cannot migrate to the base Sharp image service, a third-party extraction of the previous service is available here: github.com/Princesseuh/astro-image-service-squo…
- Deprecated
Deprecates the
functionPerRouteoptionThis option is now deprecated, and will be removed entirely in Astro v5.0. We suggest removing this option from your configuration as soon as you are able to:
import { defineConfig } from 'astro/config'; import vercel from '@astrojs/vercel/serverless'; export default defineConfig({ // ... output: 'server', adapter: vercel({ - functionPerRoute: true, }), }); - Breaking
Updates internal code to works with Astro 5 changes to hybrid rendering. No changes are necessary to your project, apart from using Astro 5
Major Changes
- Breaking
Removed support for the Squoosh image service. As the underlying library
libsquooshis no longer maintained, and the image service sees very little usage we have decided to remove it from Astro.Our recommendation is to use the base Sharp image service, which is more powerful, faster, and more actively maintained.
- import { squooshImageService } from "astro/config"; import { defineConfig } from "astro/config"; export default defineConfig({ - image: { - service: squooshImageService() - } });If you are using this service, and cannot migrate to the base Sharp image service, a third-party extraction of the previous service is available here: github.com/Princesseuh/astro-image-service-squo…
- Deprecated
Deprecates the
functionPerRouteoptionThis option is now deprecated, and will be removed entirely in Astro v5.0. We suggest removing this option from your configuration as soon as you are able to:
import { defineConfig } from 'astro/config'; import vercel from '@astrojs/vercel/serverless'; export default defineConfig({ // ... output: 'server', adapter: vercel({ - functionPerRoute: true, }), }); - Breaking
Updates internal code to works with Astro 5 changes to hybrid rendering. No changes are necessary to your project, apart from using Astro 5
- Breaking
Welcome to the Astro 5 beta! This release has no changes from the latest alpha of this package, but it does bring us one step closer to the final, stable release.
Starting from this release, no breaking changes will be introduced unless absolutely necessary.
To learn how to upgrade, check out the Astro v5.0 upgrade guide in our beta docs site.
- Breaking
Updates esbuild dependency to v0.24.0
- Breaking
Updates internal code for Astro 5 changes. No changes is required to your project, apart from using Astro 5
Minor Changes
Cleans up
astro:envsupport
- 5.x
5.5.4
17 Oct 2024Fixes
context.rewritein edge middleware
5.5.3
17 Sep 2024Allows
-in hostnames for Netlify Image CDN RegEx
5.5.2
10 Sep 2024Prevent crawling for dependencies outside of the workspace root
5.5.1
15 Aug 2024Apply polyfills immediately on function execution
This moves up when the polyfills are applied so that they are present before Astro runs, preventing a race condition that can cause
cryptoto not be defined early enough in Node 18.
5.5.0
3 Aug 2024Sets immutable cache headers for static assets
5.4.0
10 Jul 2024Refactors the adapter to use the Netlify Frameworks API
Allows support for
node:prefixed imports if using the Adapter withedgeMiddleware: true
5.3.5
1 Jul 2024Fixes a regression where edge middleware tried to bundle node builtins
5.3.4
1 Jul 2024Fixes an issue where files were not included in the SSR function when built in a monorepo
5.3.3
27 Jun 2024Improves performance for serverless function builds by not bundling dependencies
5.3.2
20 Jun 2024Fixes
astro:envgetSecret compatibility
5.3.1
17 Jun 2024Fixes backwards compatibility with Astro <= 4.9
5.3.0
10 Jun 2024Adds support for experimental
astro:envreleased in Astro 4.10
5.2.1
7 May 2024Fixes an issue with edge middleware where
process.envwas not defined, by using a polyfill to shim it
5.2.0
19 Mar 2024Adds support for
image.remotePatternsandimages.domainswith Netlify Image CDN
5.1.3
26 Feb 2024Fixes an issue where some astro CLI commands failed with
crypto is not definedon Astro 4.4.0 and earlier.
5.1.2
13 Feb 2024Fixes an issue where enabling
edgeMiddlewarefailed to bundle a dependency (cssesc) introduced in Astro 4.2.5.
5.1.1
12 Feb 2024Fixes bug where prerendered 404 pages were served as
text/plaininstead oftext/htmlfor hybrid/server apps, leading to browsers displaying source code instead of rendering it
5.1.0
7 Feb 2024Implements verification for edge middleware. This is a security measure to ensure that your serverless functions are only ever called by your edge middleware and not by a third party.
When
edgeMiddlewareis enabled, the serverless function will now respond with403 Forbiddenfor requests that are not verified to have come from the generated edge middleware. No user action is necessary.
5.0.1
1 Feb 2024Fixes a bug in the Netlify Adapter where prerendered 404.astro pages weren't shown on hybrid/server deployments.
5.0.0
23 Jan 2024- Breaking
Updates the internals of the integration to support Astro 4.0. See this upstream pull request for additional details. Warning: Make sure to upgrade your Astro version to
>4.2as previous versions are no longer supported.
- 4.x
4.1.1
11 Jan 2024Updates the behavior of the
cacheOnDemandPagessetting to only cache GET/HEAD requests by default
4.1.0
3 Jan 2024Adds opt-out option for Image CDN.
4.0.2
28 Dec 2023Updates Netlify README.md
4.0.1
19 Dec 2023Fix crash when reading package.json version field
4.0.0
18 Dec 2023- Breaking
Netlify Adapter v4 simplifies static + SSR deployments
This update is a complete overhaul of the Netlify adapter. It simplifies the user-facing config, and resolves a number of bugs along the way.
Here's what changes:
Major Changes
- Breaking
Netlify Adapter v4 simplifies static + SSR deployments
This update is a complete overhaul of the Netlify adapter. It simplifies the user-facing config, and resolves a number of bugs along the way.
Here's what changes:
Netlify Context is automatically available via Locals
In v3, you could use
netlify-edge-middleware.tsto inject data from the Netlify context into your Astro locals. In v4, this file is no longer needed because the Netlify context is automatically made available viaAstro.locals.netlify.context. You can use this context to access information about the user (like geolocation or IP address), your Netlify site (like deploy ID) or the request (like its request ID or the CDN region it's served from).Action Required: Remove the
netlify-edge-middleware.tsornetlify-edge-middleware.jsfile. In your codebase, change all usage of locals injected through that file to useAstro.locals.netlify.contextinstead.Image CDN
v4 of this adapter integrates your Astro site with Netlify Image CDN. This allows transforming images on-the-fly without impacting build times. It's implemented using an Astro Image Service, and enabled by default.
Replacement for On-Demand Builders
On-Demand Builders (ODB) allows SSR-Rendered pages to be cached using a Time to Live (TTL) strategy. While the Netlify platform continues to support existing pages with ODBs, we now recommend using the much more powerful Fine-Grained Cache Control going forward.
In v3, you could deploy your SSR-Rendered Astro pages to ODBs by enabling the
buildersconfig option, and then specifying the TTL on a per-page basis. In v4, a newcacheOnDemandPagesoption replaces this config option. Take a look at the README to learn more about this.Action Required: Replace the
buildersconfig option withcacheOnDemandPages.// astro.config.mjs export default defineConfig({ // ... adapter: netlify({ - builders: true + cacheOnDemandPages: true }), });functionPerRoutewas removedIn v3, the
functionPerRouteoption allowed the SSR routes to be split up into multiple Netlify Functions. This reduced the bundle sizes of each individual function, with the intention of speeding up code parsing, and therefore the time of cold starts. In practice, this benefit is often nullified by the increase in number of cold starts - more handlers means fewer requests per handler, means more cold starts.In v4, support for this deployment mode was removed.
Action Required: Remove the
functionPerRoutefield from your config.binaryMediaTypeswas removedbinaryMediaTypeswas a workaround required for some Astro endpoints, because v3 deployed those as "old" Netlify Functions (now referred to as "Lambda Compatibility Mode"). v4 uses the new Netlify Functions 2.0, which simply doesn't need this workaround anymore - so we're removing it 🎉Action Required: Remove the
binaryMediaTypesfield from your config.- 3.x
3.1.1
7 Dec 2023Maintenance only: docs, tests, build or refactoring. Nothing changes in how you use it.
3.1.0
6 Dec 2023Fixes an issue where this package could not be installed alongside Astro 4.0.
3.0.4
3 Nov 2023Updates dependencies
3.0.3
16 Oct 2023Updates repository information
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.