Skip to content

docs: fix Unstorage session driver examples - #14409

Open
MHJahanbakhsh wants to merge 1 commit into
withastro:mainfrom
MHJahanbakhsh:fix/session-unstorage-docs-snippet-14339
Open

docs: fix Unstorage session driver examples#14409
MHJahanbakhsh wants to merge 1 commit into
withastro:mainfrom
MHJahanbakhsh:fix/session-unstorage-docs-snippet-14339

Conversation

@MHJahanbakhsh

Copy link
Copy Markdown

Changes

Fixes #14339

Per maintainer guidance on that issue:

  • Replace invalid Redis tls example option with ttl
  • Type the Redis driver config parameter as RedisOptions
  • Adapt unstorage drivers to Astro's SessionDriver interface in the "Alternatively" / sessions guide examples so the snippets typecheck

Also softens the claim that Unstorage driver types are directly compatible with SessionDriver, since that is what caused the TypeScript errors.

Notes

Replace invalid `tls` config with `ttl`, type the Redis driver config as
`RedisOptions`, and adapt unstorage drivers to Astro's `SessionDriver`
interface so the snippets typecheck.

Fixes withastro#14339
@astrobot-houston

Copy link
Copy Markdown
Contributor

Hello! Thank you for opening your first PR to Astro’s Docs! 🎉

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any broken links you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Netlify 🥳.

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

@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/sessions.mdx Source changed, localizations will be marked as outdated.
en/reference/session-driver-reference.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.

@ArmandPhilippot ArmandPhilippot left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks, I left two suggestions: a nit and something that should be reworded.

I also note that using AI is fine, but you are still required to adhere to the repository's conventions and contribution guidelines.

  • You did not use our PR template
  • Writing "English docs only (src/content/docs/en/…). Code sample changes should be translated." is AI slop. This is not helpful for maintainers. This is expected for any contributors.

entrypoint: 'unstorage/drivers/redis',
config: {
tls: true
// Options are forwarded to the unstorage Redis driver (see its RedisOptions type)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

nit: Because we can't have a link here, I think the parentheses is not useful:

Suggested change
// Options are forwarded to the unstorage Redis driver (see its RedisOptions type)
// Options are forwarded to the unstorage Redis driver

```

Alternatively, you can import and use an unstorage driver directly in the implementation. For example:
Alternatively, you can import an unstorage driver in the implementation and adapt it to Astro's `SessionDriver` interface. For example:

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The page doesn't explicitly says what is the SessionDriver type. So, I think we should reword this a bit and add a link to the section where we describe the expected methods. Something like:

Suggested change
Alternatively, you can import an unstorage driver in the implementation and adapt it to Astro's `SessionDriver` interface. For example:
Alternatively, you can import an unstorage driver and [implement a session driver](#the-session-driver-implementation) by wrapping the available methods. For example:

@ArmandPhilippot ArmandPhilippot added the improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes) label Aug 17, 2026
@github-actions

github-actions Bot commented Aug 17, 2026

Copy link
Copy Markdown

Preview deployment

✅ Deployment complete!

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

Labels

improve or update documentation Enhance / update existing documentation (e.g. add example, improve description, update for changes)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Conflicting types in the "Unstorage compatibility" example

3 participants