zuplo 7.15.32 → 7.15.33

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (82) hide show
  1. package/docs/ai-gateway/custom-pricing.mdx +54 -0
  2. package/docs/ai-gateway/jev.mdx +35 -0
  3. package/docs/ai-gateway/managing-apps.mdx +17 -0
  4. package/docs/ai-gateway/managing-providers.mdx +11 -0
  5. package/docs/ai-gateway/observability/analytics.mdx +2 -2
  6. package/docs/ai-gateway/openrouter.mdx +20 -0
  7. package/docs/ai-gateway/routing.mdx +40 -1
  8. package/docs/ai-gateway/universal-api.mdx +50 -6
  9. package/docs/ai-gateway/user-apps.mdx +44 -2
  10. package/docs/analytics/shared-controls.md +5 -0
  11. package/docs/analytics/tabs/consumers.md +36 -0
  12. package/docs/articles/api-key-api.mdx +16 -1
  13. package/docs/articles/api-key-buckets.mdx +1 -1
  14. package/docs/articles/api-key-consumer-bucket-portal-ui.mdx +1 -1
  15. package/docs/articles/api-key-self-serve-integration.mdx +1 -1
  16. package/docs/articles/api-lint-configuration.mdx +21 -0
  17. package/docs/articles/api-lint-custom-rules.mdx +6 -0
  18. package/docs/articles/branch-based-deployments.mdx +11 -3
  19. package/docs/articles/ci-cd-azure/multi-stage-deployment.mdx +2 -2
  20. package/docs/articles/ci-cd-azure/pr-preview-environments.mdx +23 -4
  21. package/docs/articles/ci-cd-azure/tag-based-releases.mdx +1 -1
  22. package/docs/articles/ci-cd-bitbucket/multi-stage-deployment.mdx +3 -4
  23. package/docs/articles/ci-cd-bitbucket/pr-preview-environments.mdx +6 -5
  24. package/docs/articles/ci-cd-bitbucket/tag-based-releases.mdx +1 -1
  25. package/docs/articles/ci-cd-circleci/multi-stage-deployment.mdx +2 -3
  26. package/docs/articles/ci-cd-circleci/pr-preview-environments.mdx +6 -5
  27. package/docs/articles/ci-cd-circleci/tag-based-releases.mdx +1 -3
  28. package/docs/articles/ci-cd-github/basic-deployment.mdx +6 -6
  29. package/docs/articles/ci-cd-github/cleanup-on-branch-delete.mdx +8 -20
  30. package/docs/articles/ci-cd-github/deploy-and-test.mdx +3 -3
  31. package/docs/articles/ci-cd-github/local-testing.mdx +1 -1
  32. package/docs/articles/ci-cd-github/multi-stage-deployment.mdx +2 -3
  33. package/docs/articles/ci-cd-github/pr-preview-environments.mdx +20 -31
  34. package/docs/articles/ci-cd-github/tag-based-releases.mdx +5 -3
  35. package/docs/articles/ci-cd-gitlab/mr-preview-environments.mdx +10 -4
  36. package/docs/articles/ci-cd-gitlab/multi-stage-deployment.mdx +3 -3
  37. package/docs/articles/ci-cd-gitlab/tag-based-releases.mdx +1 -1
  38. package/docs/articles/custom-ci-cd-azure.mdx +2 -2
  39. package/docs/articles/custom-ci-cd-bitbucket.mdx +2 -2
  40. package/docs/articles/custom-ci-cd-circleci.mdx +2 -2
  41. package/docs/articles/custom-ci-cd-github.mdx +10 -11
  42. package/docs/articles/custom-ci-cd-gitlab.mdx +2 -2
  43. package/docs/articles/environment-variables.mdx +55 -0
  44. package/docs/articles/monetization/api-access.mdx +126 -9
  45. package/docs/articles/monetization/meters.mdx +49 -2
  46. package/docs/articles/monetization/subscription-lifecycle.md +117 -19
  47. package/docs/articles/monetization/usage.mdx +58 -0
  48. package/docs/articles/monorepo-deployment.mdx +10 -25
  49. package/docs/articles/openapi.mdx +14 -0
  50. package/docs/articles/support.mdx +35 -0
  51. package/docs/articles/testing-preview-environments.mdx +1 -1
  52. package/docs/cli/delete.mdx +50 -0
  53. package/docs/cli/delete.partial.mdx +52 -0
  54. package/docs/cli/deploy.mdx +35 -18
  55. package/docs/cli/deploy.partial.mdx +35 -18
  56. package/docs/cli/variable-delete.mdx +36 -0
  57. package/docs/cli/variable-delete.partial.mdx +37 -0
  58. package/docs/concepts/source-control-and-deployment.mdx +5 -5
  59. package/docs/dedicated/source-control.mdx +1 -1
  60. package/docs/dev-portal/dev-portal-create-consumer-on-auth.mdx +1 -1
  61. package/docs/dev-portal/overview.mdx +23 -0
  62. package/docs/dev-portal/zudoku/components/alert.mdx +1 -1
  63. package/docs/dev-portal/zudoku/configuration/api-reference.md +52 -0
  64. package/docs/dev-portal/zudoku/configuration/authentication-auth0.md +25 -0
  65. package/docs/dev-portal/zudoku/configuration/authentication-azure-ad.md +7 -0
  66. package/docs/dev-portal/zudoku/configuration/authentication-openid.md +48 -2
  67. package/docs/dev-portal/zudoku/configuration/authentication.md +4 -0
  68. package/docs/dev-portal/zudoku/configuration/build-configuration.mdx +4 -0
  69. package/docs/dev-portal/zudoku/configuration/navigation.mdx +15 -1
  70. package/docs/dev-portal/zudoku/configuration/overview.md +3 -0
  71. package/docs/dev-portal/zudoku/custom-plugins.md +38 -1
  72. package/docs/dev-portal/zudoku/guides/server-side-content-protection.md +7 -7
  73. package/docs/dev-portal/zudoku/openapi-extensions/x-enum-descriptions.md +85 -0
  74. package/docs/dev-portal/zudoku-partials/configuration/authentication-auth0.partial.md +24 -0
  75. package/docs/errors/build-error.mdx +58 -0
  76. package/docs/mcp-gateway/auth/configuring-entra.mdx +59 -0
  77. package/docs/mcp-gateway/auth/configuring-okta.mdx +30 -6
  78. package/docs/mcp-gateway/auth/configuring-workos.mdx +26 -0
  79. package/docs/mcp-gateway/auth/overview.mdx +2 -2
  80. package/docs/policies/request-validation-inbound/doc.md +54 -0
  81. package/docs/programmable-api/environment.mdx +10 -2
  82. package/package.json +5 -5
@@ -37,6 +37,7 @@ Add the `authentication` property to your [Dev Portal configuration](./overview.
37
37
  | `issuer` | Yes | The issuer URL. Dev Portal discovers endpoints from `<issuer>/.well-known/openid-configuration`. |
38
38
  | `scopes` | No | Scopes to request. Defaults to `["openid", "profile", "email"]`. |
39
39
  | `allowInsecureRequests` | No | Allow discovery and token requests against an `http://` issuer. Defaults to `false`. Intended only for local development — never enable this in production. |
40
+ | `disableUserInfo` | No | Don't call the UserInfo endpoint and build the user profile from the ID token's claims instead. Defaults to `false`. See [User Profile](#user-profile). |
40
41
 
41
42
  ## Provider Setup
42
43
 
@@ -130,6 +131,48 @@ After sign-in Dev Portal calls the provider's
130
131
  `name`, `email`, `picture`, and `email_verified` from the response. Map these claims in your
131
132
  provider if they are not emitted by default.
132
133
 
134
+ ### Without the UserInfo Endpoint
135
+
136
+ Some providers don't let a browser call the UserInfo endpoint, for example because it doesn't allow
137
+ cross-origin requests from your site. Set `disableUserInfo` to `true` and Dev Portal never calls it:
138
+
139
+ ```typescript title="zudoku.config.ts"
140
+ {
141
+ authentication: {
142
+ type: "openid",
143
+ clientId: "<your-client-id>",
144
+ issuer: "<the-issuer-url>",
145
+ disableUserInfo: true,
146
+ },
147
+ }
148
+ ```
149
+
150
+ Dev Portal also skips UserInfo when the discovery document doesn't advertise a `userinfo_endpoint`. The
151
+ option works the same way for the `entra` and `auth0` providers.
152
+
153
+ Without UserInfo, the profile is built from the claims of the ID token that the token endpoint
154
+ returns at sign-in:
155
+
156
+ - The ID token must contain `name`, `email`, `picture`, and `email_verified`. Most providers add
157
+ them for the `profile` and `email` scopes, but some only put them in the UserInfo response unless
158
+ you configure them for the ID token.
159
+ - Custom claims in the ID token, such as roles or groups, are part of the profile. Claims that
160
+ describe the token itself (`iss`, `aud`, `exp`, `nonce` and the like) are not.
161
+ - Sign-in fails if the token response contains no ID token, so keep the `openid` scope.
162
+
163
+ In [SSR mode](./protected-routes.md#server-side-protection-ssr-mode) the server checks the access
164
+ token on every request. Without UserInfo, the access token must be a JWT signed by your provider.
165
+ Dev Portal verifies it against the provider's `jwks_uri` and requires:
166
+
167
+ - the issuer's `iss` and an `exp`;
168
+ - that it was issued to your app: with `audience` set, its `aud` must match `audience`; without it,
169
+ your `clientId` must appear in `aud`, `azp`, `client_id` or `cid` (Okta). Set `audience` if your
170
+ provider puts none of these in its access tokens.
171
+
172
+ The server-side profile then comes from the access token's claims, so add `name` and `email` to it
173
+ if you show them. Opaque access tokens can't be verified this way, so the server rejects them and
174
+ the user is signed out on the next page load.
175
+
133
176
  ## Local Development with an HTTP Issuer
134
177
 
135
178
  `oauth4webapi` (the library Dev Portal uses under the hood) rejects issuers that don't use `https://` by
@@ -155,8 +198,11 @@ production issuer.
155
198
 
156
199
  - **Discovery fails**: verify `<issuer>/.well-known/openid-configuration` resolves and matches the
157
200
  `issuer` value in the document.
158
- - **CORS errors on token / userinfo**: add your site origin to the provider's allowed origins.
201
+ - **CORS errors on token / userinfo**: add your site origin to the provider's allowed origins. If
202
+ your provider can't allow browser calls to the UserInfo endpoint, set `disableUserInfo` to `true`
203
+ (see [Without the UserInfo Endpoint](#without-the-userinfo-endpoint)).
159
204
  - **Redirect URI mismatch**: the URI registered with the provider must match the Dev Portal origin
160
205
  exactly, including protocol and port.
161
206
  - **Missing profile fields**: ensure `profile` and `email` scopes are granted and that the provider
162
- includes `name`, `email`, and `picture` claims in the UserInfo response.
207
+ includes `name`, `email`, and `picture` claims in the UserInfo response, or in the ID token when
208
+ `disableUserInfo` is `true`.
@@ -217,6 +217,10 @@ fields are used to display the user profile:
217
217
 
218
218
  If the provider does not return a field, it will be left blank.
219
219
 
220
+ For the `openid`, `entra`, and `auth0` providers you can set `disableUserInfo: true` to read these
221
+ fields from the ID token instead of calling the User Info endpoint. See
222
+ [Without the UserInfo Endpoint](./authentication-openid.md#without-the-userinfo-endpoint).
223
+
220
224
  ## Redirects after sign-in
221
225
 
222
226
  By default, users return to the page they started from after signing in. For
@@ -138,6 +138,9 @@ Configuration for the prerendering process that generates static HTML pages duri
138
138
 
139
139
  - `workers`: Number of parallel workers to use for prerendering. Defaults to 80% of available CPU
140
140
  cores.
141
+ - `criticalCss`: Inline the CSS needed for each statically generated page and defer the full
142
+ stylesheet. This is opt-in because the generated inline styles require an appropriate Content
143
+ Security Policy.
141
144
 
142
145
  ```ts
143
146
  import os from "node:os";
@@ -145,6 +148,7 @@ import os from "node:os";
145
148
  export default {
146
149
  prerender: {
147
150
  workers: 4, // Fixed number of workers
151
+ criticalCss: true,
148
152
  },
149
153
  };
150
154
 
@@ -360,7 +360,7 @@ type NavigationCustomPage = {
360
360
  type: "custom-page";
361
361
  path: string;
362
362
  label?: string;
363
- element: any;
363
+ element: React.ReactNode | (() => Promise<{ default: React.ComponentType }>);
364
364
  icon?: string; // Lucide icon name
365
365
  layout?: "default" | "none";
366
366
  badge?: {
@@ -382,6 +382,20 @@ type NavigationCustomPage = {
382
382
  Set `layout: "none"` to render the page without the default Dev Portal layout (header, sidebar, footer).
383
383
  This is useful for fully custom landing pages.
384
384
 
385
+ To load the page in its own chunk, pass a function that imports a module whose default export is the
386
+ page component:
387
+
388
+ ```tsx
389
+ {
390
+ type: "custom-page",
391
+ path: "/a-custom-page",
392
+ element: () => import("./src/MyCustomPage"),
393
+ }
394
+ ```
395
+
396
+ Lazy-load pages behind [protected routes](../guides/server-side-content-protection.md) so their code
397
+ stays out of the public bundle.
398
+
385
399
  ### `type: separator`
386
400
 
387
401
  A visual divider line in the sidebar. Use separators to create visual breaks between groups of
@@ -297,6 +297,9 @@ URL.
297
297
  `from` paths can contain `:param` segments and a trailing `*` wildcard. See
298
298
  [Redirects](/dev-portal/zudoku/guides/redirects#path-parameters-and-wildcards) for details.
299
299
 
300
+ A `from` or `to` path that starts or ends with whitespace, including a non-breaking space, fails
301
+ `zudoku build`. The dev server shows a warning instead.
302
+
300
303
  ### `port`
301
304
 
302
305
  The port on which the development server will run. Defaults to `3000`. This option can also be
@@ -14,7 +14,8 @@ documentation site. This guide will show you how to create and use plugins in yo
14
14
  All plugins in Dev Portal must implement the `ZudokuPlugin` type, which is a union of these plugin
15
15
  interfaces:
16
16
 
17
- - **CommonPlugin**: Basic plugin with initialization, head elements, and MDX component customization
17
+ - **CommonPlugin**: Basic plugin with initialization, head elements, MDX component customization,
18
+ and a React provider that wraps the app
18
19
  - **ProfileMenuPlugin**: Add custom items to the profile menu
19
20
  - **NavigationPlugin**: Define custom routes and sidebar items
20
21
  - **ApiIdentityPlugin**: Provide API identities for testing
@@ -145,6 +146,42 @@ declare global {
145
146
  }
146
147
  ```
147
148
 
149
+ ### React Providers
150
+
151
+ Some libraries are set up by wrapping your app in a React context provider. Use the `Provider`
152
+ option to wrap the whole Dev Portal app with one. For example, to use
153
+ [`posthog-js`](https://posthog.com/docs/libraries/react) instead of adding a snippet with `getHead`:
154
+
155
+ ```tsx
156
+ import { PostHogProvider } from "posthog-js/react";
157
+ import type { ZudokuPlugin } from "zudoku";
158
+
159
+ const posthogPlugin: ZudokuPlugin = {
160
+ Provider: ({ children }) => (
161
+ <PostHogProvider
162
+ apiKey={import.meta.env.ZUDOKU_PUBLIC_POSTHOG_KEY}
163
+ options={{ api_host: "https://us.i.posthog.com" }}
164
+ >
165
+ {children}
166
+ </PostHogProvider>
167
+ ),
168
+ };
169
+ ```
170
+
171
+ `Provider` is a regular React component:
172
+
173
+ - It renders inside Zudoku's own providers, so it can use hooks like `useZudoku` or `useAuth` from
174
+ `zudoku/hooks`. It mounts once all plugins have finished `initialize`.
175
+ - It stays mounted when the user navigates between pages.
176
+ - If several plugins define a `Provider`, they are nested in the order of the `plugins` array, so
177
+ the first plugin's provider is the outermost one.
178
+ - It also renders during prerendering and server-side rendering. Keep browser-only code, like
179
+ accessing `window`, inside effects. Keep per-user data in component state instead of module scope,
180
+ where the server would share it between requests.
181
+
182
+ To wrap only your plugin's own routes, see
183
+ [Wrapping Routes with Context or Layout](#wrapping-routes-with-context-or-layout).
184
+
148
185
  ### Navigation Plugin
149
186
 
150
187
  ```tsx
@@ -86,8 +86,8 @@ dicts.
86
86
  | -------------------------------- | ----------------------------- | -------------- |
87
87
  | MDX docs (`plugin-docs`) | Shape B (route dict) | ✅ |
88
88
  | File OpenAPI (`plugin-api`) | Shape A (via `openApiPlugin`) | ✅ |
89
- | User custom pages with `lazy` | Shape A (`{path, lazy}`) | ✅ |
90
- | User custom pages with `element` | Not code-split | ❌ (see below) |
89
+ | Lazy custom pages | Shape A (`{path, element}`) | ✅ |
90
+ | Inline JSX custom pages | Not code-split | ❌ (see below) |
91
91
  | URL-based OpenAPI (`type: url`) | Fetched at runtime | ❌ (see below) |
92
92
  | Raw inline OpenAPI (`type: raw`) | Inlined in main bundle | ❌ (see below) |
93
93
 
@@ -103,7 +103,7 @@ not detected:
103
103
  navigation: items.map((i) => ({
104
104
  type: "custom-page",
105
105
  path: `/foo/${i.slug}`,
106
- lazy: () => import(`./Foo-${i.slug}`),
106
+ element: () => import(`./Foo-${i.slug}`),
107
107
  }));
108
108
  ```
109
109
 
@@ -117,7 +117,7 @@ them:
117
117
  items: items.map((i) => ({
118
118
  type: "custom-page",
119
119
  path: i.slug,
120
- lazy: () => import(`./Foo-${i.slug}`),
120
+ element: () => import(`./Foo-${i.slug}`),
121
121
  })),
122
122
  }
123
123
  ```
@@ -137,10 +137,10 @@ Writing
137
137
  ships `<Secret />` directly in the main bundle. There's no chunk to gate and no URL to block; the
138
138
  runtime `RouteGuard` prevents rendering but the JavaScript is already on the user's machine.
139
139
 
140
- **Fix:** switch to `lazy`:
140
+ **Fix:** lazy-load it:
141
141
 
142
142
  ```ts
143
- { type: "custom-page", path: "/secret", lazy: () => import("./Secret") }
143
+ { type: "custom-page", path: "/secret", element: () => import("./Secret") }
144
144
  ```
145
145
 
146
146
  ### URL-based OpenAPI specs
@@ -197,7 +197,7 @@ server-side, use an SSR adapter.
197
197
  ## Pre-ship checklist
198
198
 
199
199
  - [ ] Build passes (any unmatched `protectedRoutes` pattern fails the build).
200
- - [ ] Any custom pages meant to be protected use `lazy: () => import(...)`, not `element`.
200
+ - [ ] Any custom pages meant to be protected use `element: () => import(...)`, not inline JSX.
201
201
  - [ ] Any dynamically-generated protected routes are nested under a static-path ancestor.
202
202
  - [ ] URL-based and raw inline OpenAPI specs have their own access control at their origin.
203
203
  - [ ] Visit a protected chunk URL directly in an unauthenticated browser (grab one from DevTools)
@@ -0,0 +1,85 @@
1
+ ---
2
+ title: x-enum-descriptions
3
+ sidebar_icon: list
4
+ applies_to:
5
+ product: developer-portal
6
+ hosting: all
7
+ ---
8
+
9
+ Use `x-enum-descriptions` to explain what each value of an `enum` means. Dev Portal lists the
10
+ descriptions next to their values wherever the enum is shown: in request and response schemas,
11
+ object properties, and parameters. Without it, readers see the values only.
12
+
13
+ Dev Portal accepts both `x-enum-descriptions` and `x-enumDescriptions`. If a schema sets both, the
14
+ camelCase `x-enumDescriptions` takes precedence.
15
+
16
+ ## Location
17
+
18
+ The extension is added at the **Schema Object** level, next to the `enum` it describes. For an
19
+ array, add it to the `items` schema. For a parameter, add it to the parameter's `schema`.
20
+
21
+ | Option | Type | Description |
22
+ | --------------------------------------------- | ---------------------- | --------------------------------------------------------------- |
23
+ | `x-enum-descriptions` or `x-enumDescriptions` | `object` or `string[]` | A description for each enum value, in one of the formats below. |
24
+
25
+ ## Formats
26
+
27
+ ### Map of values to descriptions
28
+
29
+ Use an object whose keys are enum values and whose values are descriptions.
30
+
31
+ ```yaml
32
+ status:
33
+ type: string
34
+ enum: [CREATED, IN_TRANSIT, DELIVERED, EXCEPTION]
35
+ x-enum-descriptions:
36
+ CREATED: Manifest logged and cargo sealed in the stasis bay, awaiting launch clearance.
37
+ IN_TRANSIT: Cargo is aboard a freighter, currently in warp between waypoints.
38
+ DELIVERED: Docked at the destination port and signed for by the recipient.
39
+ EXCEPTION: Delayed by an anomaly such as an ion storm, customs hold or quantum drift.
40
+ ```
41
+
42
+ ### Map nested under `values`
43
+
44
+ Some generators wrap the same map in a `values` property. Dev Portal reads it the same way.
45
+
46
+ ```yaml
47
+ status:
48
+ type: string
49
+ enum: [CREATED, IN_TRANSIT, DELIVERED, EXCEPTION]
50
+ x-enum-descriptions:
51
+ values:
52
+ CREATED: Manifest logged and cargo sealed in the stasis bay.
53
+ IN_TRANSIT: Cargo is aboard a freighter, currently in warp.
54
+ DELIVERED: Docked at the destination port and signed for.
55
+ EXCEPTION: Delayed by an anomaly such as an ion storm.
56
+ ```
57
+
58
+ ### Array aligned with `enum`
59
+
60
+ Use an array of strings where each entry describes the `enum` value at the same position. Tools such
61
+ as openapi-generator emit this format.
62
+
63
+ ```yaml
64
+ status:
65
+ type: string
66
+ enum: [CREATED, IN_TRANSIT, DELIVERED, EXCEPTION]
67
+ x-enum-descriptions:
68
+ - Manifest logged and cargo sealed in the stasis bay.
69
+ - Cargo is aboard a freighter, currently in warp.
70
+ - Docked at the destination port and signed for.
71
+ - Delayed by an anomaly such as an ion storm.
72
+ ```
73
+
74
+ Keep the array in the same order as `enum`. Dev Portal pairs entries by position, ignores empty entries,
75
+ and ignores entries beyond the length of `enum`.
76
+
77
+ ## Behavior
78
+
79
+ - A value without a description is still listed in the enum, with an empty description.
80
+ - Entries that aren't strings are ignored.
81
+ - If no usable descriptions remain, Dev Portal shows the plain list of enum values.
82
+
83
+ ## Related
84
+
85
+ - [`x-display-name`](./x-display-name) — set a friendlier label for a tag
@@ -0,0 +1,24 @@
1
+ ## Auth0 with Zuplo API key management
2
+
3
+ If your Developer Portal uses
4
+ [Zuplo API key management](/docs/articles/api-key-management) so consumers can
5
+ create and manage their own keys, set `audience` in your Auth0 configuration.
6
+ Zuplo API key management requires a JWT access token. Without an `audience`,
7
+ Auth0 issues an opaque access token, and the portal can't use it to manage API
8
+ keys. When this happens, the portal shows a "Configuration Error" explaining
9
+ that the authentication provider issued an opaque token.
10
+
11
+ Create an API in Auth0 as described in the optional audience step earlier on
12
+ this page, then set `audience` to that API's identifier:
13
+
14
+ ```typescript title="docs/zudoku.config.tsx"
15
+ authentication: {
16
+ type: "auth0",
17
+ domain: "your-domain.us.auth0.com",
18
+ clientId: "<your-auth0-client-id>",
19
+ audience: "https://your-domain.com/api", // Your Auth0 API identifier
20
+ }
21
+ ```
22
+
23
+ Use the RS256 signing algorithm for the Auth0 API. If your portal doesn't use
24
+ API key management, you can still leave `audience` unset.
@@ -16,9 +16,67 @@ the project fails to compile during deployment.
16
16
  installed or does not exist.
17
17
  - **Invalid route configuration** - The `routes.oas.json` file contains syntax
18
18
  errors or references policies or handlers that do not exist.
19
+ - **Missing export** - A policy or route handler refers to an export that its
20
+ module doesn't contain. See [Missing export](#missing-export).
21
+ - **Schema errors in `policies.json` and routes** - A value in
22
+ `config/policies.json` or in a route's `x-zuplo-route` doesn't match the
23
+ expected format. See
24
+ [Schema errors in policies.json and routes](#schema-errors-in-policiesjson-and-routes).
19
25
  - **Incompatible dependencies** - A package dependency has version conflicts or
20
26
  is not compatible with the Zuplo runtime.
21
27
 
28
+ ## Missing export
29
+
30
+ If the `export` of a policy in `config/policies.json`, or of a route handler,
31
+ isn't in the module that `module` names, the build fails. The error names the
32
+ export, the module, and the policy:
33
+
34
+ ```text
35
+ Could not find export "McpCapabilityFilterInboundPolicy" in '@zuplo/runtime' for
36
+ policy 'mcp-capability-filter-inbound' at /policies/0/handler in
37
+ /config/policies.json. It is exported from '@zuplo/runtime/mcp-gateway'; set
38
+ "module" to "$import(@zuplo/runtime/mcp-gateway)".
39
+ ```
40
+
41
+ To fix it:
42
+
43
+ - Check the spelling and capitalization of `export`. When a similar name exists
44
+ in the module, the error suggests it (`Did you mean 'MyPolicy'?`).
45
+ - If the export lives in a different entry point of the same package, the error
46
+ names it. Change `module` to that entry point. For example, policies for the
47
+ MCP Gateway come from `$import(@zuplo/runtime/mcp-gateway)`, not from
48
+ `$import(@zuplo/runtime)`.
49
+ - For a custom module, make sure the file exports the name and compiles without
50
+ errors.
51
+
52
+ A policy that no route uses only produces a warning, because nothing calls it
53
+ yet. The build fails as soon as a route uses that policy.
54
+
55
+ ## Schema errors in policies.json and routes
56
+
57
+ The build validates `config/policies.json` and the `x-zuplo-route` of every
58
+ route in your OpenAPI files. Each error names the file and the
59
+ [JSON pointer](https://datatracker.ietf.org/doc/html/rfc6901) of the invalid
60
+ value, and quotes the value when it's short:
61
+
62
+ ```text
63
+ Must match pattern "^[0-9a-z-]+$". Found "$env(POLICY_NAME)" at /policies/0/name
64
+ in /config/policies.json.
65
+ ```
66
+
67
+ ```text
68
+ Value of property 'corsPolicy' must be 'string'. Found 42 at
69
+ /paths/~1todos~1{id}/get/x-zuplo-route/corsPolicy in ./config/routes.oas.json.
70
+ ```
71
+
72
+ Use the pointer to find the value. In the first example, `/policies/0/name` is
73
+ the `name` of the first entry in `policies`. Fix the value so that it matches
74
+ the format the message describes.
75
+
76
+ [`$env()`](../programmable-api/environment.mdx#where-env-is-allowed) is only
77
+ allowed in some locations. Using it in a policy `name`, for example, produces a
78
+ schema error like the first one above.
79
+
22
80
  ## How to access build logs
23
81
 
24
82
  1. Open the Zuplo portal and navigate to the project.
@@ -91,6 +91,53 @@ Add the policy to `config/policies.json`:
91
91
  Set the three environment variables in your project's environment configuration.
92
92
  The secret values belong in the project secret store.
93
93
 
94
+ ### Use a national cloud or External ID tenant
95
+
96
+ By default the policy signs users in on the global Microsoft Entra cloud. Set
97
+ `cloud` when your tenant lives elsewhere:
98
+
99
+ | `cloud` | Use for | Sign-in host |
100
+ | ------------------ | --------------------------------------------- | --------------------------- |
101
+ | `global` (default) | Microsoft Entra ID | `login.microsoftonline.com` |
102
+ | `us-government` | Microsoft Entra ID for US Government | `login.microsoftonline.us` |
103
+ | `china` | Microsoft Entra ID operated by 21Vianet | `login.chinacloudapi.cn` |
104
+ | `external-id` | Microsoft Entra External ID (external tenant) | `{tenantId}.ciamlogin.com` |
105
+
106
+ ```json
107
+ {
108
+ "options": {
109
+ "tenantId": "$env(ENTRA_TENANT_ID)",
110
+ "cloud": "us-government",
111
+ "clientId": "$env(ENTRA_CLIENT_ID)",
112
+ "clientSecret": "$env(ENTRA_CLIENT_SECRET)"
113
+ }
114
+ }
115
+ ```
116
+
117
+ For an External ID tenant, register the application in the external tenant and
118
+ use that tenant's ID as `tenantId`.
119
+
120
+ If your External ID tenant uses a
121
+ [custom URL domain](https://learn.microsoft.com/entra/external-id/customers/how-to-custom-url-domain),
122
+ also set `customDomain` to that hostname. Users sign in on the custom domain,
123
+ and the policy keeps validating tokens against the issuer External ID puts in
124
+ them, `https://{tenantId}.ciamlogin.com/{tenantId}/v2.0`:
125
+
126
+ ```json
127
+ {
128
+ "options": {
129
+ "tenantId": "$env(ENTRA_TENANT_ID)",
130
+ "cloud": "external-id",
131
+ "customDomain": "login.example.com",
132
+ "clientId": "$env(ENTRA_CLIENT_ID)",
133
+ "clientSecret": "$env(ENTRA_CLIENT_SECRET)"
134
+ }
135
+ }
136
+ ```
137
+
138
+ `customDomain` is a bare hostname, without `https://`, a port, a trailing slash,
139
+ or a path. It works only with `cloud` set to `external-id`.
140
+
94
141
  Attach the policy to each MCP route in `config/routes.oas.json` and register the
95
142
  gateway plugin in `modules/zuplo.runtime.ts` (see
96
143
  [Configuring Auth0](./configuring-auth0.mdx#wire-the-policy-into-the-gateway)
@@ -98,6 +145,8 @@ for the route and plugin patterns — they're identical across all wrappers).
98
145
 
99
146
  ## What the wrapper derives
100
147
 
148
+ With the default `global` cloud, the wrapper derives:
149
+
101
150
  | Generic field | Derived value |
102
151
  | ----------------------- | -------------------------------------------------------------------- |
103
152
  | `oidc.issuer` | `https://login.microsoftonline.com/{tenantId}/v2.0` |
@@ -105,6 +154,11 @@ for the route and plugin patterns — they're identical across all wrappers).
105
154
  | `browserLogin.url` | `https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/authorize` |
106
155
  | `browserLogin.tokenUrl` | `https://login.microsoftonline.com/{tenantId}/oauth2/v2.0/token` |
107
156
 
157
+ Other `cloud` values replace `login.microsoftonline.com` with that cloud's
158
+ sign-in host. With `customDomain`, only `browserLogin.url` and
159
+ `browserLogin.tokenUrl` move to the custom domain; `oidc.issuer` and
160
+ `oidc.jwksUrl` stay on `{tenantId}.ciamlogin.com`.
161
+
108
162
  ## Test the configuration
109
163
 
110
164
  The fastest sanity check is to connect an MCP client:
@@ -130,6 +184,11 @@ endpoint with `curl` so you can see the raw responses.
130
184
  - **`AADSTS700016` application not found.** The client ID doesn't belong to the
131
185
  tenant the wrapper is configured with. Make sure `tenantId` and `clientId`
132
186
  come from the same app registration.
187
+ - **`customDomain is only supported with cloud "external-id"` at boot.** Custom
188
+ URL domains apply only to External ID tenants. Set `cloud` to `external-id`,
189
+ or remove `customDomain`.
190
+ - **Sign-in fails for a US Government, 21Vianet, or External ID tenant.** The
191
+ policy is using the global cloud. Set `cloud` to match where the tenant lives.
133
192
 
134
193
  ## Related
135
194
 
@@ -83,12 +83,31 @@ Add the policy to `config/policies.json`:
83
83
 
84
84
  :::caution
85
85
 
86
- `oktaDomain` is a **bare hostname** like `acme.okta.com` or
87
- `acme.oktapreview.com`. Don't include `https://`, a trailing slash, or an
88
- `/oauth2/...` path.
86
+ `oktaDomain` is a **bare hostname**: the domain your users sign in on. Use your
87
+ Okta org domain, such as `acme.okta.com` or `acme.okta-emea.com`, or your Okta
88
+ custom domain, such as `login.example.com`. Don't include `https://`, a port, a
89
+ trailing slash, or an `/oauth2/...` path.
89
90
 
90
91
  :::
91
92
 
93
+ ### Use an Okta custom domain
94
+
95
+ If your users sign in on an
96
+ [Okta custom domain](https://developer.okta.com/docs/guides/custom-url-domain/main/),
97
+ set `oktaDomain` to that domain. The policy derives the issuer from
98
+ `oktaDomain`, and the issuer in Okta's tokens must match it exactly:
99
+
100
+ 1. Set the issuer to **Custom URL** or **Dynamic** so tokens carry the custom
101
+ domain instead of the Okta org domain:
102
+ - For a custom authorization server, open **Security → API → Authorization
103
+ Servers**, edit the server, and change **Issuer**.
104
+ - For the org authorization server, open the application's **Sign On** tab
105
+ and change **Issuer** under **OpenID Connect ID Token**.
106
+ 2. Confirm the `issuer` value at
107
+ `https://<oktaDomain>/.well-known/openid-configuration`, or
108
+ `https://<oktaDomain>/oauth2/<authorizationServerId>/.well-known/openid-configuration`
109
+ for a custom authorization server.
110
+
92
111
  Set the three environment variables in your project's environment configuration.
93
112
  `OKTA_DOMAIN` goes in plain config; the secret values belong in the project
94
113
  secret store.
@@ -151,7 +170,7 @@ policy by name to each route.
151
170
 
152
171
  | Option | Required | Default | Notes |
153
172
  | ----------------------------------------- | -------- | ---------------------- | ------------------------------------------------------------------------------------- |
154
- | `oktaDomain` | yes | — | Bare hostname (`acme.okta.com`). No scheme. |
173
+ | `oktaDomain` | yes | — | Okta org or custom domain as a bare hostname (`acme.okta.com`, `login.example.com`). |
155
174
  | `authorizationServerId` | no | unset (org server) | Name of an Okta custom authorization server, e.g. `default`. |
156
175
  | `clientId` | yes | — | Okta application client ID. |
157
176
  | `clientSecret` | yes | — | Okta application client secret. Use `$env(...)`. |
@@ -180,8 +199,13 @@ endpoint with `curl` so you can see the raw responses.
180
199
 
181
200
  ## Common issues
182
201
 
183
- - **"Invalid Okta domain" at boot.** `oktaDomain` includes a scheme prefix,
184
- trailing slash, or path. Use `acme.okta.com`.
202
+ - **`oktaDomain must be a bare hostname` at boot.** `oktaDomain` includes a
203
+ scheme prefix, port, trailing slash, or path. Use a hostname such as
204
+ `acme.okta.com` or `login.example.com`.
205
+ - **Token validation fails with an issuer mismatch on a custom domain.** The
206
+ authorization server still issues tokens with the Okta org domain as the
207
+ issuer. Set **Issuer** to **Custom URL** or **Dynamic**, as described in
208
+ [Use an Okta custom domain](#use-an-okta-custom-domain).
185
209
  - **Browser login redirects but the callback fails.** The
186
210
  `https://<gateway-host>/__zuplo/oauth/callback` URL isn't on the application's
187
211
  **Sign-in redirect URIs** allow-list in Okta.
@@ -88,6 +88,29 @@ WorkOS keys its OIDC issuer by the client ID. Given a `clientId` like
88
88
  These endpoint shapes come from WorkOS OIDC discovery at
89
89
  `https://api.workos.com/user_management/{clientId}/.well-known/openid-configuration`.
90
90
 
91
+ ## Use a WorkOS custom domain
92
+
93
+ If you configured a custom authentication API domain in WorkOS, set
94
+ `apiHostname` to it:
95
+
96
+ ```json
97
+ {
98
+ "options": {
99
+ "clientId": "$env(WORKOS_CLIENT_ID)",
100
+ "apiHostname": "auth.example.com",
101
+ "clientSecret": "$env(WORKOS_CLIENT_SECRET)"
102
+ }
103
+ }
104
+ ```
105
+
106
+ Every derived URL above then uses that host instead of `api.workos.com`, so the
107
+ issuer matches the one WorkOS puts in tokens issued on your domain. Confirm the
108
+ `issuer` value at
109
+ `https://<apiHostname>/user_management/<clientId>/.well-known/openid-configuration`.
110
+
111
+ `apiHostname` is a bare hostname, without `https://`, a port, a trailing slash,
112
+ or a path.
113
+
91
114
  ## Test the configuration
92
115
 
93
116
  The fastest sanity check is to connect an MCP client:
@@ -113,6 +136,9 @@ endpoint with `curl` so you can see the raw responses.
113
136
  - **JWKS fetch fails.** The client ID doesn't match the API key's environment.
114
137
  Make sure both `clientId` and `clientSecret` come from the same WorkOS
115
138
  environment.
139
+ - **Token validation fails with an issuer mismatch.** WorkOS issues tokens on
140
+ your custom authentication API domain, but the policy still uses
141
+ `api.workos.com`. Set `apiHostname` to the custom domain.
116
142
 
117
143
  ## Related
118
144
 
@@ -182,11 +182,11 @@ endpoints automatically. Under the hood every wrapper composes the generic
182
182
  | **Google** | `mcp-google-oauth-inbound` | `clientId`, `clientSecret` | [Google](./configuring-google.mdx) |
183
183
  | **Keycloak** | `mcp-keycloak-oauth-inbound` | `keycloakBaseUrl`, `realm`, client creds | [Keycloak](./configuring-keycloak.mdx) |
184
184
  | **Logto** | `mcp-logto-oauth-inbound` | `logtoEndpoint`, `clientId`, `clientSecret` | [Logto](./configuring-logto.mdx) |
185
- | **Microsoft Entra ID** | `mcp-entra-oauth-inbound` | `tenantId`, `clientId`, `clientSecret` | [Microsoft Entra](./configuring-entra.mdx) |
185
+ | **Microsoft Entra ID** | `mcp-entra-oauth-inbound` | `tenantId` (and `cloud`), client creds | [Microsoft Entra](./configuring-entra.mdx) |
186
186
  | **Okta** | `mcp-okta-oauth-inbound` | `oktaDomain`, client creds | [Okta](./configuring-okta.mdx) |
187
187
  | **OneLogin** | `mcp-onelogin-oauth-inbound` | `oneLoginSubdomain`, client creds | [OneLogin](./configuring-onelogin.mdx) |
188
188
  | **PingOne** | `mcp-ping-oauth-inbound` | `environmentId` (or `customDomain`), client creds | [PingOne](./configuring-ping.mdx) |
189
- | **WorkOS** | `mcp-workos-oauth-inbound` | `clientId`, `clientSecret` | [WorkOS](./configuring-workos.mdx) |
189
+ | **WorkOS** | `mcp-workos-oauth-inbound` | `clientId` (and `apiHostname`), `clientSecret` | [WorkOS](./configuring-workos.mdx) |
190
190
  | Any other OIDC IdP (Ory Hydra, Authentik, custom…) | `mcp-oauth-inbound` | `oidc.issuer`, `oidc.jwksUrl`, `browserLogin.url` | [Generic OIDC](./configuring-generic-oidc.mdx) |
191
191
 
192
192
  The upstream side uses a separate policy, `mcp-token-exchange-inbound`, one per