Skip to content

bug: global-variables plugin routes not mounted after PR #743 merge #758

@cp-bwg

Description

@cp-bwg

Summary

The global-variables plugin merged in PR #743 has its code in packages/core/src/plugins/core-plugins/global-variables-plugin/ but the routes (/api/global-variables, /admin/global-variables) are never actually mounted into the running Hono app. Enabling the plugin from the admin Plugins page has no effect — the endpoints return 404.

Expected Behavior

After activating the Global Variables plugin from /admin/plugins:

  • GET /api/global-variables should return the variables list
  • GET /admin/global-variables should render the admin page
  • The sidebar should show a "Global Variables" menu item

Actual Behavior

  • All routes return 404
  • No menu item appears in the sidebar
  • The plugin shows as "active" in the plugins table but has no runtime effect

Root Cause

The PluginBuilder.addRoute() method stores route metadata on the plugin object, but there is no bootstrap step that iterates over active plugins and mounts their Hono route handlers into the main app. The plugin effectively exists as dead code after the merge.

This appears to affect any plugin that relies solely on PluginBuilder.addRoute() for route registration — the metadata is recorded but never acted upon by the plugin manager or app factory.

Steps to Reproduce

  1. Fresh npm install && npm run dev
  2. Go to /admin/plugins
  3. Activate "Global Variables"
  4. Navigate to /admin/global-variables → 404
  5. GET /api/global-variables → 404

Workaround

Mount the routes manually in the app's index.ts using the exported Hono route handlers:

import { globalVariablesApiRoutes, globalVariablesAdminRoutes } from './plugins/global-variables-plugin'

// Mount manually after createSonicJSApp()
app.route('/api/global-variables', globalVariablesApiRoutes)
app.route('/admin/global-variables', globalVariablesAdminRoutes)

This is what we did in our implementation (see PR #757 for the full working integration).

Related

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