Skip to content

CommonJS exports.X = async () => {} route handlers aren't indexed as symbols #1675

Closed

Description

@azorlu80

Version: v1.6.0

Handlers written as exports.foo = () => {} / exports.foo = async () => {} (a very common Express/CommonJS controller style) don't seem to be indexed as function nodes. node/callers can't find them, and calls into them collapse to file level (the calling function is lost).

Repro:

  1. controller.js:
    exports.getItems = async (req, res) => { /* ... */ };
    wired in a router: router.get('/items', getItems)
  2. codegraph node getItems → "Symbol not found", although it's a real, route-wired handler.

Impact: in one real Express codebase, 60+ route handlers written in this style are invisible to the graph, so impact/callers analysis silently misses them.

Ask: index the exports.<name> = (arrow | async arrow | function) assignment form as a function node — the same treatment const X = () => {} already gets.

Activity

  1. danusha2345 commented on Sep 4, 2026

    @danusha2345
    Contributor

    Reproduced on 1.6.0 and fixed in #1678: exports.NAME = <arrow|function> and module.exports.NAME = … are extracted as exported function nodes (both the wasm walker and the kernel), so node getItems / callers find the handler and its calls belong to it rather than the file. Other member assignments (handlers.onSave = () => {}) are untouched.

  2. colbymchenry commented on Sep 8, 2026

    @colbymchenry
    Owner

    Fixed and verified on Linux in #1771 (lands conflict-resolved #1678 onto current main).

    exports.NAME = <arrow|function> and module.exports.NAME = … are now extracted as exported function nodes in both the wasm walker and the kernel, so node / callers find the handlers and their calls belong to them rather than the file. Other member assignments (handlers.onSave = () => {}) stay untouched.

    Re-index JavaScript projects after upgrading.

  3. added a commit that references this issue on Sep 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions