Skip to content

Document session: false opt-out and session runtime tree-shaking#14251

Open
adamchal wants to merge 1 commit into
withastro:mainfrom
adamchal:docs/session-false
Open

Document session: false opt-out and session runtime tree-shaking#14251
adamchal wants to merge 1 commit into
withastro:mainfrom
adamchal:docs/session-false

Conversation

@adamchal

Copy link
Copy Markdown
Contributor

Accompanies withastro/astro#16871.

Description (required)

Documents withastro/astro#16871, which adds a session: false config option to opt out of session support entirely, and tree-shakes the session runtime (AstroSession + unstorage) out of the SSR bundle for any project where no session driver is wired.

Changes (English only):

  • guides/sessions.mdx: new "Disabling sessions" section (<Since v="7.1.0" />) covering the session: false option, that adapters skip wiring their default driver, that Astro.session/context.session are undefined (same as a project without sessions configured, so Astro.session?.get() feature detection keeps working), and a note that the runtime is tree-shaken automatically for any driver-less project even without the flag.
  • reference/api-reference.mdx: session type corrected to AstroSession | undefined, and the disabled case added to the list of situations where session is undefined.
  • guides/integrations-guide/cloudflare.mdx: note in the Sessions section that session: false means no KV binding is configured, no KV namespace is provisioned on deploy, and the session runtime is excluded from the Worker bundle.
  • guides/integrations-guide/netlify.mdx: note that session: false means Netlify Blobs is not configured for session storage and the runtime is excluded from the function bundle.
  • guides/integrations-guide/node.mdx: note that session: false means the filesystem driver is not configured and the runtime is excluded from the server bundle.
  • reference/modules/astro-fetch.mdx: note on the sessions() pipeline handler that it registers no provider (and ctx.session is undefined) when no driver is configured or sessions are disabled.

References

Discord username: adam.chal

@astrobot-houston

Copy link
Copy Markdown
Contributor

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/guides/integrations-guide/cloudflare.mdx Source changed, localizations will be marked as outdated.
en/guides/integrations-guide/netlify.mdx Source changed, localizations will be marked as outdated.
en/guides/integrations-guide/node.mdx Source changed, localizations will be marked as outdated.
en/guides/sessions.mdx Source changed, localizations will be marked as outdated.
en/reference/api-reference.mdx Source changed, localizations will be marked as outdated.
en/reference/modules/astro-fetch.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

Preview deployment

✅ Deployment complete!

## Disabling sessions

<p>
<Since v="7.1.0" />

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This may not make the Astro 7.1 release, so this will need to be updated accordingly.

```
</Steps>

## Disabling sessions

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
## Disabling sessions
### Disabling sessions

I think this might be better served as an <h3> so it sits under “Configuring sessions” instead of top level.

Before

  • Overview
  • Configuring sessions
    • Overriding the configuration at runtime
  • Disabling sessions
  • Interacting with session data
    • Astro components and pages
    • API endpoints
    • Actions
    • Middleware
  • Session data types

After

  • Overview
  • Configuring sessions
    • Overriding the configuration at runtime
    • Disabling sessions
  • Interacting with session data
    • Astro components and pages
    • API endpoints
    • Actions
    • Middleware
  • Session data types

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants