mirror of
https://github.com/complexcaresolutions/cms.c2sgmbh.git
synced 2026-03-17 16:14:12 +00:00
fix(admin): disable custom views due to path-to-regexp bug
Custom admin views cause TypeError: Missing parameter name at 5 when used with @payloadcms/plugin-multi-tenant. This appears to be a bug in Payload 3.68.4's custom view handling. Changes: - Disable custom TenantDashboard view temporarily - Keep TenantBreadcrumb in afterNavLinks (works correctly) - Add bug report template for Payload team See BUG_REPORT_CUSTOM_VIEWS.md for full details. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
6d40d81a44
commit
4129ec516b
2 changed files with 135 additions and 14 deletions
126
BUG_REPORT_CUSTOM_VIEWS.md
Normal file
126
BUG_REPORT_CUSTOM_VIEWS.md
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
# Bug Report: Custom Admin Views 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`.
|
||||
|
||||
## Environment
|
||||
- **Payload Version:** 3.68.4
|
||||
- **Next.js Version:** 15.5.9
|
||||
- **React Version:** 19.2.3
|
||||
- **Node.js Version:** 22.x
|
||||
- **Database:** PostgreSQL 17.6
|
||||
- **Plugin:** @payloadcms/plugin-multi-tenant 3.68.4
|
||||
|
||||
## Steps to Reproduce
|
||||
|
||||
1. Create a Payload 3.x project with the multi-tenant plugin
|
||||
2. Add a custom view to the admin config:
|
||||
|
||||
```typescript
|
||||
// payload.config.ts
|
||||
export default buildConfig({
|
||||
admin: {
|
||||
user: Users.slug,
|
||||
components: {
|
||||
views: {
|
||||
MyCustomView: {
|
||||
Component: '@/components/admin/MyCustomView#MyCustomView',
|
||||
path: '/my-custom-view',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
plugins: [
|
||||
multiTenantPlugin({
|
||||
tenantsSlug: 'tenants',
|
||||
collections: { /* ... */ },
|
||||
}),
|
||||
// other plugins...
|
||||
],
|
||||
})
|
||||
```
|
||||
|
||||
3. Create a simple client component:
|
||||
|
||||
```tsx
|
||||
// src/components/admin/MyCustomView.tsx
|
||||
'use client'
|
||||
|
||||
import React from 'react'
|
||||
|
||||
export const MyCustomView: React.FC = () => {
|
||||
return (
|
||||
<div style={{ padding: '2rem' }}>
|
||||
<h1>Custom View</h1>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
export default MyCustomView
|
||||
```
|
||||
|
||||
4. Build and run the project
|
||||
5. Navigate to `/admin/my-custom-view`
|
||||
|
||||
## Expected Behavior
|
||||
The custom view should render correctly.
|
||||
|
||||
## Actual Behavior
|
||||
A server-side error occurs with the following message in production:
|
||||
|
||||
```
|
||||
Uncaught Error: An error occurred in the Server Components render.
|
||||
The specific message is omitted in production builds to avoid leaking sensitive details.
|
||||
```
|
||||
|
||||
When running in development or checking server logs, the actual error is:
|
||||
|
||||
```
|
||||
⨯ TypeError: Missing parameter name at 5
|
||||
at <unknown> (.next/server/chunks/XXXX.js:5:9989)
|
||||
at <unknown> (.next/server/chunks/XXXX.js:5:10666)
|
||||
at g (.next/server/chunks/XXXX.js:5:11896)
|
||||
at e (.next/server/chunks/824.js:96:517138)
|
||||
at <unknown> (.next/server/app/(payload)/admin/[[...segments]]/page.js:1:31665)
|
||||
at Array.find (<anonymous>)
|
||||
at <unknown> (.next/server/app/(payload)/admin/[[...segments]]/page.js:1:31644)
|
||||
at ax (.next/server/app/(payload)/admin/[[...segments]]/page.js:1:34637) {
|
||||
digest: '3964718924'
|
||||
}
|
||||
```
|
||||
|
||||
## Additional Context
|
||||
|
||||
### What works:
|
||||
- Admin panel without custom views
|
||||
- Components in `afterNavLinks` (e.g., TenantBreadcrumb)
|
||||
- Components in `beforeNavLinks` (e.g., DashboardNavLink)
|
||||
|
||||
### What fails:
|
||||
- ANY custom view registered via `admin.components.views`, even the simplest component without any dependencies
|
||||
|
||||
### 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
|
||||
|
||||
### Workaround
|
||||
Disable custom views and use only `afterNavLinks`/`beforeNavLinks` components:
|
||||
|
||||
```typescript
|
||||
admin: {
|
||||
components: {
|
||||
afterNavLinks: ['@/components/admin/TenantBreadcrumb#TenantBreadcrumb'],
|
||||
// views disabled due to bug
|
||||
},
|
||||
},
|
||||
```
|
||||
|
||||
## Related Plugins
|
||||
- `@payloadcms/plugin-multi-tenant` (may be related to the conflict)
|
||||
- `@payloadcms/plugin-redirects`
|
||||
- `@payloadcms/plugin-seo`
|
||||
- `@payloadcms/plugin-form-builder`
|
||||
- `@payloadcms/plugin-nested-docs`
|
||||
|
|
@ -100,20 +100,15 @@ export default buildConfig({
|
|||
components: {
|
||||
// Tenant-Kontext in der Admin-Header-Leiste anzeigen
|
||||
afterNavLinks: ['@/components/admin/TenantBreadcrumb#TenantBreadcrumb'],
|
||||
// Custom Views
|
||||
views: {
|
||||
// Tenant Self-Service Dashboard
|
||||
tenantDashboard: {
|
||||
Component: '@/components/admin/TenantDashboardView#TenantDashboardView',
|
||||
path: '/tenant-dashboard',
|
||||
meta: {
|
||||
title: 'Tenant Dashboard',
|
||||
description: 'E-Mail-Statistiken und Übersicht für Ihren Tenant',
|
||||
},
|
||||
},
|
||||
},
|
||||
// Navigation um Dashboard-Link zu ergänzen
|
||||
beforeNavLinks: ['@/components/admin/DashboardNavLink#DashboardNavLink'],
|
||||
// Custom Views disabled due to bug - see https://github.com/payloadcms/payload/issues/XXXX
|
||||
// TypeError: Missing parameter name at 5 (path-to-regexp error)
|
||||
// views: {
|
||||
// TenantDashboard: {
|
||||
// Component: '@/components/admin/TenantDashboardView#TenantDashboardView',
|
||||
// path: '/tenant-dashboard',
|
||||
// },
|
||||
// },
|
||||
// beforeNavLinks: ['@/components/admin/DashboardNavLink#DashboardNavLink'],
|
||||
},
|
||||
},
|
||||
// Multi-Tenant Email Adapter
|
||||
|
|
|
|||
Loading…
Reference in a new issue