You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Automatically configures filesystem storage when experimental session enabled
6
+
7
+
If the `experimental.session` flag is enabled when using the Node adapter, Astro will automatically configure session storage using the filesystem driver. You can still manually configure session storage if you need to use a different driver or want to customize the session storage configuration.
8
+
9
+
See [the experimental session docs](https://docs.astro.build/en/reference/experimental-flags/sessions/) for more information on configuring session storage.
Adds support for adapters auto-configuring experimental session storage drivers.
6
+
7
+
Adapters can now configure a default session storage driver when the `experimental.session` flag is enabled. If a hosting platform has a storage primitive that can be used for session storage, the adapter can automatically configure the session storage using that driver. This allows Astro to provide a more seamless experience for users who want to use sessions without needing to manually configure the session storage.
Automatically configures Netlify Blobs storage when experimental session enabled
6
+
7
+
If the `experimental.session` flag 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.
8
+
9
+
See [the experimental session docs](https://docs.astro.build/en/reference/experimental-flags/sessions/) for more information on configuring session storage.
:warning:**BREAKING CHANGE FOR EXPERIMENTAL SESSIONS ONLY**:warning:
6
+
7
+
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.
8
+
9
+
```diff
10
+
defineConfig({
11
+
// ...
12
+
experimental: {
13
+
- session: {
14
+
- driver: 'upstash',
15
+
- },
16
+
+ session: true,
17
+
},
18
+
+ session: {
19
+
+ driver: 'upstash',
20
+
+ },
21
+
});
22
+
```
23
+
24
+
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.
25
+
26
+
```diff
27
+
defineConfig({
28
+
adapter: node({
29
+
mode: "standalone",
30
+
}),
31
+
experimental: {
32
+
- session: {
33
+
- driver: 'fs',
34
+
- cookie: 'astro-cookie',
35
+
- },
36
+
+ session: true,
37
+
},
38
+
+ session: {
39
+
+ cookie: 'astro-cookie',
40
+
+ },
41
+
});
42
+
```
43
+
44
+
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](https://docs.astro.build/en/reference/experimental-flags/sessions/).
* Your project must have a server output to use sessions.
1821
+
*/
1822
+
exportconstSessionWithoutServerOutputError={
1823
+
name: 'SessionWithoutServerOutputError',
1824
+
title: 'Sessions must be used with server output.',
1825
+
message:
1826
+
'A server is required to use sessions. To deploy routes to a server, add an adapter to your Astro config and configure your route for on-demand rendering',
1827
+
hint: 'Add an adapter and enable on-demand rendering: https://docs.astro.build/en/guides/on-demand-rendering/',
1828
+
}satisfiesErrorData;
1829
+
1830
+
/**
1831
+
* @docs
1832
+
* @message Error when initializing session storage with driver `DRIVER`. `ERROR`
* Thrown when the session data could not be saved.
1853
+
*/
1854
+
exportconstSessionStorageSaveError={
1855
+
name: 'SessionStorageSaveError',
1856
+
title: 'Session data could not be saved.',
1857
+
message: (error: string,driver?: string)=>
1858
+
`Error when saving session data${driver ? ` with driver \`${driver}\`` : ''}. \`${error??''}\``,
1859
+
hint: 'For more information, see https://docs.astro.build/en/reference/experimental-flags/sessions/',
1860
+
}satisfiesErrorData;
1861
+
1862
+
/**
1863
+
* @docs
1864
+
* @message The `experimental.session` flag was set to `true`, but no storage was configured. Either configure the storage manually or use an adapter that provides session storage
* Thrown when session storage is enabled but not configured.
1869
+
*/
1870
+
exportconstSessionConfigMissingError={
1871
+
name: 'SessionConfigMissingError',
1872
+
title: 'Session storage was enabled but not configured.',
1873
+
message:
1874
+
'The `experimental.session` flag was set to `true`, but no storage was configured. Either configure the storage manually or use an adapter that provides session storage',
0 commit comments