From 774f59e13f1f4385e33cf7a14e8ab13dfd905964 Mon Sep 17 00:00:00 2001 From: Justin Blumencranz <96924014+j15z@users.noreply.github.com> Date: Wed, 2 Sep 2026 12:36:35 -0700 Subject: [PATCH 1/2] fix(pdf): keep PDF.js external in production --- apps/sim/next-config.test.ts | 11 +++++++++++ apps/sim/next.config.ts | 5 +++++ 2 files changed, 16 insertions(+) create mode 100644 apps/sim/next-config.test.ts diff --git a/apps/sim/next-config.test.ts b/apps/sim/next-config.test.ts new file mode 100644 index 00000000000..3e943b58409 --- /dev/null +++ b/apps/sim/next-config.test.ts @@ -0,0 +1,11 @@ +/** + * @vitest-environment node + */ +import { describe, expect, it } from 'vitest' +import nextConfig from '@/next.config' + +describe('Next.js server dependency packaging', () => { + it('keeps pdfjs external to the production server bundle', () => { + expect(nextConfig.serverExternalPackages).toContain('pdfjs-dist') + }) +}) diff --git a/apps/sim/next.config.ts b/apps/sim/next.config.ts index 261091bffbc..1b1489c7e69 100644 --- a/apps/sim/next.config.ts +++ b/apps/sim/next.config.ts @@ -99,6 +99,11 @@ const nextConfig: NextConfig = { '@daytona/sdk', '@earendil-works/pi-ai', '@earendil-works/pi-coding-agent', + /** + * PDF.js loads its worker and optional canvas primitives relative to its package at runtime. + * Bundling relocates that code and leaves DOMMatrix unavailable in the standalone image. + */ + 'pdfjs-dist', // The collab-doc seed converter lazily `require`s jsdom for a headless TipTap editor. Keep it // external so webpack doesn't try to bundle jsdom's dynamic internal requires. 'jsdom', From cf77e69af732f4a63d05b91c8fdd47bd42fc29cf Mon Sep 17 00:00:00 2001 From: Justin Blumencranz <96924014+j15z@users.noreply.github.com> Date: Wed, 2 Sep 2026 13:01:40 -0700 Subject: [PATCH 2/2] chore(pdf): align config test filename --- apps/sim/{next-config.test.ts => next.config.test.ts} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename apps/sim/{next-config.test.ts => next.config.test.ts} (100%) diff --git a/apps/sim/next-config.test.ts b/apps/sim/next.config.test.ts similarity index 100% rename from apps/sim/next-config.test.ts rename to apps/sim/next.config.test.ts