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
The `projectConfig` object contains essential configurations related to the Medusa application, such as database and CORS configurations.
72
72
73
+
### cookieOptions
74
+
75
+
<Note>
76
+
77
+
This option is available since Medusa [v2.8.5](https://github.com/medusajs/medusa/releases/tag/v2.8.5).
78
+
79
+
</Note>
80
+
81
+
The `projectConfig.cookieOptions` configuration defines cookie options to be passed to `express-session` when creating the session cookie. This configuration is useful when simulating a production environment locally, where you may need to set options like `secure` or `sameSite`.
82
+
83
+
#### Example
84
+
85
+
```ts title="medusa-config.ts"
86
+
module.exports=defineConfig({
87
+
projectConfig: {
88
+
cookieOptions: {
89
+
sameSite: "lax",
90
+
},
91
+
// ...
92
+
},
93
+
// ...
94
+
})
95
+
```
96
+
97
+
#### Properties
98
+
99
+
Aside from the following options, you can pass any property that the [express-session's cookie option accepts](https://www.npmjs.com/package/express-session).
100
+
101
+
<TypeList
102
+
types={[
103
+
{
104
+
name: "secure",
105
+
type: "`boolean`",
106
+
description: `Whether the cookie should only be sent over HTTPS. This is useful in production environments where you want to ensure that cookies are only sent over secure connections.`,
107
+
defaultValue: `false in development, true in production`
108
+
},
109
+
{
110
+
name: "sameSite",
111
+
type: "`lax` | `strict` | `none`",
112
+
description: `Controls the SameSite attribute of the cookie.`,
113
+
defaultValue: `"none" in production. In development, this attribute is not set.`
114
+
},
115
+
{
116
+
name: "maxAge",
117
+
type: "`number`",
118
+
description: "The maximum age of the cookie in milliseconds set in the `Set-Cookie` header.",
119
+
defaultValue: "Either the `sessionOptions.ttl` option, or `10` hours."
120
+
},
121
+
{
122
+
name: "httpOnly",
123
+
type: "`boolean`",
124
+
description: "Whether to set the `HttpOnly Set-Cookie` attribute.",
125
+
defaultValue: `true`
126
+
},
127
+
{
128
+
name: "priority",
129
+
type: "`low` \| `medium` \| `high`",
130
+
description: "The value of the [Priority Set-Cookie attribute](https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1)",
131
+
defaultValue: `medium`
132
+
},
133
+
{
134
+
name: "domain",
135
+
type: "`string`",
136
+
description: "The value of the `Domain Set-Cookie` attribute. By default, no domain is set, and most clients will consider the cookie to apply to the current domain only."
137
+
},
138
+
{
139
+
name: "path",
140
+
type: "`string`",
141
+
description: "The value of the `Path Set-Cookie` attribute",
142
+
defaultValue: `/`
143
+
},
144
+
{
145
+
name: "signed",
146
+
type: "`boolean`",
147
+
description: "Whether to sign the cookie.",
148
+
defaultValue: `true`
149
+
}
150
+
]}
151
+
openedLevel={1}
152
+
/>
153
+
73
154
### databaseDriverOptions
74
155
75
156
The `projectConfig.databaseDriverOptions` configuration is an object of additional options used to configure the PostgreSQL connection. For example, you can support TLS/SSL connection using this configuration's `ssl` property.
Copy file name to clipboardExpand all lines: www/apps/book/app/learn/fundamentals/api-routes/retrieve-custom-links/page.mdx
+8-3Lines changed: 8 additions & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -45,7 +45,7 @@ The API routes that restrict the fields and relations you can retrieve are:
45
45
46
46
### How to Override Allowed Fields and Relations
47
47
48
-
For these routes, you need to override the allowed fields and relations to be retrieved. You can do this by adding a [middleware](../middlewares/page.mdx) to those routes.
48
+
For these routes, you need to override the allowed fields and relations to be retrieved. You can do this by applying a [global middleware](../middlewares/page.mdx) to those routes.
49
49
50
50
For example, to allow retrieving the `b2b_company` of a customer using the [Get Customer Admin API Route](!api!/admin#customers_getcustomersid), create the file `src/api/middlewares.ts` with the following content:
@@ -203,20 +200,6 @@ The `setStepSuccess` method of the workflow engine's main service accepts as a p
203
200
description: "Set the response of the step. This is similar to the response you return in a step's definition, but since the `async` step doesn't have a response, you set its response when changing its status.",
204
201
optional: false
205
202
},
206
-
{
207
-
name: "options",
208
-
type: "`Record<string, any>`",
209
-
description: "Options to pass to the step.",
210
-
optional: true,
211
-
children: [
212
-
{
213
-
name: "container",
214
-
type: "`MedusaContainer`",
215
-
description: "An instance of the Medusa Container",
The `projectConfig` object contains essential configurations related to the Medusa application, such as database and CORS configurations.
142
142
143
+
### cookieOptions
144
+
145
+
This option is available since Medusa [v2.8.5](https://github.com/medusajs/medusa/releases/tag/v2.8.5).
146
+
147
+
The `projectConfig.cookieOptions` configuration defines cookie options to be passed to `express-session` when creating the session cookie. This configuration is useful when simulating a production environment locally, where you may need to set options like `secure` or `sameSite`.
148
+
149
+
#### Example
150
+
151
+
```ts title="medusa-config.ts"
152
+
module.exports = defineConfig({
153
+
projectConfig: {
154
+
cookieOptions: {
155
+
sameSite: "lax",
156
+
},
157
+
// ...
158
+
},
159
+
// ...
160
+
})
161
+
```
162
+
163
+
#### Properties
164
+
165
+
Aside from the following options, you can pass any property that the [express-session's cookie option accepts](https://www.npmjs.com/package/express-session).
166
+
167
+
- secure: (\`boolean\`)
168
+
- sameSite: (\`lax\` | \`strict\` | \`none\`)
169
+
- maxAge: (\`number\`) The maximum age of the cookie in milliseconds set in the \`Set-Cookie\` header.
170
+
- httpOnly: (\`boolean\`) Whether to set the \`HttpOnly Set-Cookie\` attribute.
171
+
- priority: (\`low\` | \`medium\` | \`high\`) The value of the \[Priority Set-Cookie attribute]\(https://tools.ietf.org/html/draft-west-cookie-priority-00#section-4.1)
172
+
- domain: (\`string\`) The value of the \`Domain Set-Cookie\` attribute. By default, no domain is set, and most clients will consider the cookie to apply to the current domain only.
173
+
- path: (\`string\`) The value of the \`Path Set-Cookie\` attribute
174
+
- signed: (\`boolean\`) Whether to sign the cookie.
175
+
143
176
### databaseDriverOptions
144
177
145
178
The `projectConfig.databaseDriverOptions` configuration is an object of additional options used to configure the PostgreSQL connection. For example, you can support TLS/SSL connection using this configuration's `ssl` property.
@@ -677,7 +710,7 @@ The value for this configuration can be one of the following:
677
710
```ts title="medusa-config.ts"
678
711
module.exports = defineConfig({
679
712
projectConfig: {
680
-
workerMode: process.env.WORKER_MODE || "shared",
713
+
workerMode: process.env.WORKER_MODE as "shared" | "worker" | "server" || "shared",
681
714
// ...
682
715
},
683
716
// ...
@@ -7619,7 +7652,7 @@ The API routes that restrict the fields and relations you can retrieve are:
7619
7652
7620
7653
### How to Override Allowed Fields and Relations
7621
7654
7622
-
For these routes, you need to override the allowed fields and relations to be retrieved. You can do this by adding a [middleware](https://docs.medusajs.com/learn/fundamentals/api-routes/middlewares/index.html.md) to those routes.
7655
+
For these routes, you need to override the allowed fields and relations to be retrieved. You can do this by applying a [global middleware](https://docs.medusajs.com/learn/fundamentals/api-routes/middlewares/index.html.md) to those routes.
7623
7656
7624
7657
For example, to allow retrieving the `b2b_company` of a customer using the [Get Customer Admin API Route](https://docs.medusajs.com/api/admin#customers_getcustomersid), create the file `src/api/middlewares.ts` with the following content:
@@ -17330,9 +17361,6 @@ The `setStepSuccess` method of the workflow engine's main service accepts as a p
17330
17361
17331
17362
- workflowId: (\`string\`) The ID of the workflow. This is the first parameter passed to \`createWorkflow\` when creating the workflow.
17332
17363
- stepResponse: (\`StepResponse\`) Set the response of the step. This is similar to the response you return in a step's definition, but since the \`async\` step doesn't have a response, you set its response when changing its status.
17333
-
- options: (\`Record\<string, any>\`) Options to pass to the step.
17334
-
17335
-
- container: (\`MedusaContainer\`) An instance of the Medusa Container
0 commit comments