Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions platform/frontend/next.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ const nextConfig: NextConfig = {
NEXT_PUBLIC_APP_VERSION: platformPkg.version,
},
output: "standalone",
// Version skew protection during rolling deployments.
// https://nextjs.org/docs/app/api-reference/config/next-config-js/deploymentId
// VERSION is set as a build arg by CI and baked into the
// client bundle here. On client navigation, a mismatch between
// the client's deployment id and the server's response header triggers a
// hard reload, fetching fresh assets that match the server build.
// Next.js restricts the id to [a-zA-Z0-9_-], so non-conforming characters
// (e.g. the dots in `v1.2.41`) are replaced with hyphens.
// https://nextjs.org/docs/messages/deploymentid-invalid-characters
deploymentId: process.env.VERSION?.replace(/[^a-zA-Z0-9_-]/g, "-"),
transpilePackages: ["@shared"],
// Disable dev indicators so they don't show up in docs automated screenshots
devIndicators: false,
Expand Down
10 changes: 10 additions & 0 deletions platform/frontend/src/next-config.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,17 @@ vi.mock("@sentry/nextjs", () => ({

describe("next config rewrites", () => {
beforeEach(() => {
vi.resetModules();
delete process.env.ARCHESTRA_INTERNAL_API_BASE_URL;
delete process.env.VERSION;
});

it("uses sanitized VERSION as the deployment id", async () => {
process.env.VERSION = "v1.2.41+build.5";

const { default: nextConfig } = await import("../next.config");

expect(nextConfig.deploymentId).toBe("v1-2-41-build-5");
});

it("proxies well-known oauth discovery routes to the backend by default", async () => {
Expand Down
3 changes: 2 additions & 1 deletion platform/turbo.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"tasks": {
"build": {
"dependsOn": ["^build"],
"outputs": [".next/**", "!.next/cache/**", "dist/**"]
"outputs": [".next/**", "!.next/cache/**", "dist/**"],
"env": ["VERSION"]
},
"dev": {
"persistent": true,
Expand Down
Loading