0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-03-10 23:01:26 -05:00
astro/.changeset/tricky-insects-argue.md
Matt Kane 8d4e566f54
feat: add support for automatic session driver config (#13145)
* feat: add support for automatic session driver config

* chore: fix error logic

* Lint test

* Add node support

* Add node test fixture

* Lock

* Add Netlify support

* Use workspace Astro version

* Format

* Changeset

* Add tests

* Add dep for tests

* chore: fix repo URL

* temp log

* Fix module resoltuion

* [skip ci] Update changeset

* chore: bump peer dependencies

* Changes from review

* Changeset changes from review

* Apply suggestions from code review

Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>

* More changeset detail

* Lock

---------

Co-authored-by: Sarah Rainsberger <5098874+sarah11918@users.noreply.github.com>
2025-02-12 14:57:03 +00:00

1.3 KiB

astro
patch

⚠️ BREAKING CHANGE FOR EXPERIMENTAL SESSIONS ONLY ⚠️

Changes the experimental.session option to a boolean flag and moves session config to a top-level value. This change is to allow the new automatic session driver support. You now need to separately enable the experimental.session flag, and then configure the session driver using the top-level session key if providing manual configuration.

defineConfig({
  // ...
  experimental: {
-    session: {
-      driver: 'upstash',
-    },
+    session: true,
  },
+  session: {
+    driver: 'upstash',
+  }, 
});

You no longer need to configure a session driver if you are using an adapter that supports automatic session driver configuration and wish to use its default settings.

defineConfig({
  adapter: node({
    mode: "standalone",
  }),
  experimental: {
-    session: {
-      driver: 'fs',
-      cookie: 'astro-cookie',
-    },
+    session: true,
  },
+  session: {
+    cookie: 'astro-cookie',
+  }, 
});

However, you can still manually configure additional driver options or choose a non-default driver to use with your adapter with the new top-level session config option. For more information, see the experimental session docs.