Skip to content

TypeError: Missing parameter name at 5 - Custom Admin Components + Multi-Tenant Plugin #15241

@c2s-admin

Description

@c2s-admin

Bug Description

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 affects:

  • views - custom admin views
  • afterNavLinks - components after nav links
  • beforeNavLinks - components before nav links

Even the simplest component without any dependencies triggers the error.

Environment

  • Payload Version: 3.69.0 (tested up to 3.72.0 - still broken)
  • 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.69.0

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: { /* ... */ },
}),
],
})
```

  1. 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' }}>

Custom View



)
}

export default MyCustomView
```

  1. Build and run the project
  2. Navigate to /admin/my-custom-view

Expected Behavior

The custom view should render correctly.

Actual Behavior

A server-side error occurs:

Production:
```
Uncaught Error: An error occurred in the Server Components render.
The specific message is omitted in production builds to avoid leaking sensitive details.
```

Development/Server Logs:
```
⨯ TypeError: Missing parameter name at 5
at (.next/server/chunks/XXXX.js:5:9989)
at (.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 (.next/server/app/(payload)/admin/[[...segments]]/page.js:1:31665)
at Array.find ()
at (.next/server/app/(payload)/admin/[[...segments]]/page.js:1:31644)
```

Investigation Findings

  • The error originates from path-to-regexp (version 6.3.0)
  • The error occurs during route matching in handleEndpoints.js
  • "Missing parameter name at 5" suggests an invalid route pattern like /: is being generated
  • The issue appears to be triggered by the combination of ANY custom component + multi-tenant plugin
  • Issue persists across multiple Payload versions (3.68.4 → 3.72.0)

Current Workaround

Completely disable ALL custom components:

```typescript
admin: {
user: Users.slug,
// ALL custom components disabled - triggers path-to-regexp error with multi-tenant plugin
// components: {
// afterNavLinks: ['...'],
// beforeNavLinks: ['...'],
// views: { ... },
// },
},
```

Impact

This bug completely blocks the ability to extend the admin panel with custom views, navigation components, or any other custom admin components when using multi-tenant setups. This significantly limits the customization capabilities of Payload CMS in enterprise/SaaS environments.

Possibly Related Issues

Additional Context

We have been tracking this issue since Payload 3.68.4. We tested versions 3.69.0, 3.70.0, 3.71.0, and 3.72.0 - the bug persists in all versions. This is a blocking issue for our multi-tenant production application.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions