langgraph-api Needs to Support ts-node-esm #385

Open
opened 2026-02-15 18:16:23 -05:00 by yindo · 0 comments
Owner

Originally created by @liSong5713 on GitHub (Dec 28, 2025).

Checked other resources

  • I added a very descriptive title to this issue.
  • I searched the LangGraph.js documentation with the integrated search.
  • I used the GitHub search to find a similar question and didn't find it.
  • I am sure that this is a bug in LangGraph.js rather than my code.
  • The bug is not resolved by updating to the latest stable version of LangGraph (or the specific integration package).

Example Code

The following code :

import { fileURLToPath } from "node:url";
import { spawn } from "node:child_process";
export async function spawnServer(args, context, options) {
    const localUrl = `http://${args.host}:${args.port}`;
    const studioUrl = `${context.hostUrl}/studio?baseUrl=${localUrl}`;
    console.log(`
          Welcome to

╦  ┌─┐┌┐┌┌─┐╔═╗┬─┐┌─┐┌─┐┬ ┬
║  ├─┤││││ ┬║ ╦├┬┘├─┤├─┘├─┤
╩═╝┴ ┴┘└┘└─┘╚═╝┴└─┴ ┴┴  ┴ ┴.js

- 🚀 API: \x1b[36m${localUrl}\x1b[0m
- 🎨 Studio UI: \x1b[36m${studioUrl}\x1b[0m

This in-memory server is designed for development and testing.
For production use, please use LangSmith Deployment.

`);
    return spawn(process.execPath, [
        fileURLToPath(new URL("../../cli.mjs", import.meta.resolve("tsx/esm/api"))),
        "watch",
        "--clear-screen=false",
        "--import",
        new URL(import.meta.resolve("../preload.mjs")).toString(),
        fileURLToPath(new URL(import.meta.resolve("./entrypoint.mjs"))),
        options.pid.toString(),
        JSON.stringify({
            port: Number.parseInt(args.port, 10),
            nWorkers: Number.parseInt(args.nJobsPerWorker, 10),
            host: args.host,
            graphs: context.config.graphs,
            auth: context.config.auth,
            ui: context.config.ui,
            ui_config: context.config.ui_config,
            cwd: options.projectCwd,
            http: context.config.http,
        }),
    ], {
        stdio: ["inherit", "inherit", "inherit", "ipc"],
        env: {
            ...context.env,
            NODE_ENV: "development",
            LANGGRAPH_API_URL: localUrl,
        },
    });
}


Error Message and Stack Trace (if applicable)

tsx (base esbuild ) not support all features of reflect-metadata

        const declaration = Reflect.getMetadata(TS_DESIGN_TYPE, proto, property);
 // declaration is undefined

Description

target code with ts-node-esm

export async function spawnServer(args, context, options) {
  const localUrl = `http://${args.host}:${args.port}`;
  const studioUrl = `${context.hostUrl}/studio?baseUrl=${localUrl}`;
  console.log(`
          Welcome to

╦  ┌─┐┌┐┌┌─┐╔═╗┬─┐┌─┐┌─┐┬ ┬
║  ├─┤││││ ┬║ ╦├┬┘├─┤├─┘├─┤
╩═╝┴ ┴┘└┘└─┘╚═╝┴└─┴ ┴┴  ┴ ┴.js

- 🚀 API: \x1b[36m${localUrl}\x1b[0m
- 🎨 Studio UI: \x1b[36m${studioUrl}\x1b[0m

This in-memory server is designed for development and testing.
For production use, please use LangSmith Deployment.

`);
  return spawn(
    process.execPath,
    [
      '--loader',
      'ts-node/esm',
      '--import',
      fileURLToPath(import.meta.resolve('../preload.mjs')),
      fileURLToPath(new URL(import.meta.resolve('./entrypoint.mjs'))),
      options.pid.toString(),
      JSON.stringify({
        port: Number.parseInt(args.port, 10),
        nWorkers: Number.parseInt(args.nJobsPerWorker, 10),
        host: args.host,
        graphs: context.config.graphs,
        auth: context.config.auth,
        ui: context.config.ui,
        ui_config: context.config.ui_config,
        cwd: options.projectCwd,
        http: context.config.http,
      }),
    ],
    {
      stdio: ['inherit', 'inherit', 'inherit', 'ipc'],
      env: {
        ...context.env,
        NODE_ENV: 'dev',
        LANGGRAPH_API_URL: localUrl,
      },
    }
  );
}

System Info

  • @langchain/langgraph-cli 1.1.2
  • mac
  • v24.11.0
  • pnpm
Originally created by @liSong5713 on GitHub (Dec 28, 2025). ### Checked other resources - [x] I added a very descriptive title to this issue. - [x] I searched the LangGraph.js documentation with the integrated search. - [x] I used the GitHub search to find a similar question and didn't find it. - [x] I am sure that this is a bug in LangGraph.js rather than my code. - [x] The bug is not resolved by updating to the latest stable version of LangGraph (or the specific integration package). ### Example Code The following code : ``` typescript import { fileURLToPath } from "node:url"; import { spawn } from "node:child_process"; export async function spawnServer(args, context, options) { const localUrl = `http://${args.host}:${args.port}`; const studioUrl = `${context.hostUrl}/studio?baseUrl=${localUrl}`; console.log(` Welcome to ╦ ┌─┐┌┐┌┌─┐╔═╗┬─┐┌─┐┌─┐┬ ┬ ║ ├─┤││││ ┬║ ╦├┬┘├─┤├─┘├─┤ ╩═╝┴ ┴┘└┘└─┘╚═╝┴└─┴ ┴┴ ┴ ┴.js - 🚀 API: \x1b[36m${localUrl}\x1b[0m - 🎨 Studio UI: \x1b[36m${studioUrl}\x1b[0m This in-memory server is designed for development and testing. For production use, please use LangSmith Deployment. `); return spawn(process.execPath, [ fileURLToPath(new URL("../../cli.mjs", import.meta.resolve("tsx/esm/api"))), "watch", "--clear-screen=false", "--import", new URL(import.meta.resolve("../preload.mjs")).toString(), fileURLToPath(new URL(import.meta.resolve("./entrypoint.mjs"))), options.pid.toString(), JSON.stringify({ port: Number.parseInt(args.port, 10), nWorkers: Number.parseInt(args.nJobsPerWorker, 10), host: args.host, graphs: context.config.graphs, auth: context.config.auth, ui: context.config.ui, ui_config: context.config.ui_config, cwd: options.projectCwd, http: context.config.http, }), ], { stdio: ["inherit", "inherit", "inherit", "ipc"], env: { ...context.env, NODE_ENV: "development", LANGGRAPH_API_URL: localUrl, }, }); } ``` ### Error Message and Stack Trace (if applicable) tsx (base esbuild ) not support all features of reflect-metadata ``` const declaration = Reflect.getMetadata(TS_DESIGN_TYPE, proto, property); // declaration is undefined ``` ### Description target code with ts-node-esm ```typescript export async function spawnServer(args, context, options) { const localUrl = `http://${args.host}:${args.port}`; const studioUrl = `${context.hostUrl}/studio?baseUrl=${localUrl}`; console.log(` Welcome to ╦ ┌─┐┌┐┌┌─┐╔═╗┬─┐┌─┐┌─┐┬ ┬ ║ ├─┤││││ ┬║ ╦├┬┘├─┤├─┘├─┤ ╩═╝┴ ┴┘└┘└─┘╚═╝┴└─┴ ┴┴ ┴ ┴.js - 🚀 API: \x1b[36m${localUrl}\x1b[0m - 🎨 Studio UI: \x1b[36m${studioUrl}\x1b[0m This in-memory server is designed for development and testing. For production use, please use LangSmith Deployment. `); return spawn( process.execPath, [ '--loader', 'ts-node/esm', '--import', fileURLToPath(import.meta.resolve('../preload.mjs')), fileURLToPath(new URL(import.meta.resolve('./entrypoint.mjs'))), options.pid.toString(), JSON.stringify({ port: Number.parseInt(args.port, 10), nWorkers: Number.parseInt(args.nJobsPerWorker, 10), host: args.host, graphs: context.config.graphs, auth: context.config.auth, ui: context.config.ui, ui_config: context.config.ui_config, cwd: options.projectCwd, http: context.config.http, }), ], { stdio: ['inherit', 'inherit', 'inherit', 'ipc'], env: { ...context.env, NODE_ENV: 'dev', LANGGRAPH_API_URL: localUrl, }, } ); } ``` ### System Info - @langchain/langgraph-cli 1.1.2 - mac - v24.11.0 - pnpm
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: langchain-ai/langgraphjs#385