From b62c559cadcf803b0c34385337551f4e38a0b1cc Mon Sep 17 00:00:00 2001 From: Martin Porwoll Date: Sat, 20 Dec 2025 15:08:27 +0000 Subject: [PATCH] docs: update bug report - all custom components affected MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit afterNavLinks also triggers the error in production builds. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 --- BUG_REPORT_CUSTOM_VIEWS.md | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/BUG_REPORT_CUSTOM_VIEWS.md b/BUG_REPORT_CUSTOM_VIEWS.md index fdd2ad4..99ab220 100644 --- a/BUG_REPORT_CUSTOM_VIEWS.md +++ b/BUG_REPORT_CUSTOM_VIEWS.md @@ -1,7 +1,7 @@ -# Bug Report: Custom Admin Views cause TypeError with path-to-regexp +# Bug Report: Custom Admin Components cause TypeError with path-to-regexp ## Summary -Custom admin views registered via `admin.components.views` cause a `TypeError: Missing parameter name at 5` error from path-to-regexp when used together with `@payloadcms/plugin-multi-tenant`. +**ALL** custom admin components registered via `admin.components` cause a `TypeError: Missing parameter name at 5` error from path-to-regexp when used together with `@payloadcms/plugin-multi-tenant`. This includes `views`, `afterNavLinks`, and `beforeNavLinks`. ## Environment - **Payload Version:** 3.68.4 @@ -92,29 +92,35 @@ When running in development or checking server logs, the actual error is: ## Additional Context ### What works: -- Admin panel without custom views -- Components in `afterNavLinks` (e.g., TenantBreadcrumb) -- Components in `beforeNavLinks` (e.g., DashboardNavLink) +- Admin panel WITHOUT any custom components (completely empty `admin.components` or omitted entirely) ### What fails: -- ANY custom view registered via `admin.components.views`, even the simplest component without any dependencies +- ANY custom component registered via `admin.components`, including: + - `views` - custom admin views + - `afterNavLinks` - components after nav links (e.g., TenantBreadcrumb) + - `beforeNavLinks` - components before nav links +- Even the simplest component without any dependencies triggers the error ### Investigation findings: - The error originates from `path-to-regexp` (version 6.3.0) - The error occurs during route matching in `handleEndpoints.js` - The error message "Missing parameter name at 5" suggests an invalid route pattern like `/:` is being generated somewhere - This happens regardless of the view path used (tested with `/dashboard`, `/tenant-dashboard`, `/test-dashboard`) -- The issue appears to be triggered by the combination of custom views and the multi-tenant plugin +- The issue appears to be triggered by the combination of ANY custom component and the multi-tenant plugin +- Initially appeared to work in development but fails consistently in production builds ### Workaround -Disable custom views and use only `afterNavLinks`/`beforeNavLinks` components: +Completely disable ALL custom components: ```typescript admin: { - components: { - afterNavLinks: ['@/components/admin/TenantBreadcrumb#TenantBreadcrumb'], - // views disabled due to bug - }, + user: Users.slug, + // ALL custom components disabled - triggers path-to-regexp error with multi-tenant plugin + // components: { + // afterNavLinks: ['...'], + // beforeNavLinks: ['...'], + // views: { ... }, + // }, }, ```