@astrojs/netlify
8.2.14 · 13 Nov 2026MIT71.2k / weekRepositoryHomepagenpmAtom feed
6.6.5 is the newest release of 6.x.
In short
1 new1 internal
Security
3 advisories affect 6.3.0; 8.2.4 fixes them
- ModerateAstro: Netlify Image CDN allowlist bypass enables SSRFGHSA-4233-jc72-56c5 · 30 Sep 2026Fixed in 8.2.4
- Moderate@astrojs/netlify broadens Astro image.remotePatterns in Netlify Image CDN configGHSA-529g-xq4f-cw38 · 16 Jun 2026Fixed in 7.0.13
- Low@astrojs/netlify generates an overly-broad Netlify Image CDN allowlist because remotePatterns.pathname metacharacters are not escapedGHSA-hp3v-mfqw-h74c · 20 Jul 2026Fixed in 8.1.2
Release note
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.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.