Why don’t Copilot actions trigger with my self-hosted server using LangChain adapter and GEMINI_API_KEY, but work with public API key?

I’m building a React.js app using CopilotKit to create a todo app with features like responding to messages, reading data, and performing actions (e.g., adding tasks).

What I’ve tried:

Initially, I used the public Copilot Cloud API key, and everything worked fine (responses, data reading, and actions).
After the free trial ended, I switched to a self-hosted server setup using the LangChain adapter and GEMINI_API_KEY.

What I want:
I need the useCopilotAction functionality (e.g., adding tasks) to work with my self-hosted server, just as it did with the public Copilot Cloud API key.

Details:
I’m using the gemini-1.5-flash model with a custom server setup in Node.js and implementing Copilot actions through the LangChain adapter. The issue I’m facing is that while message responses and readables work fine with my own server setup using my Gemini API key, Copilot actions don’t trigger. When using the public Copilot Cloud API key, everything works, including Copilot actions, but I can’t seem to get them to trigger on my custom server.

Custom server setup using gemini-1.5-flash model with my own Gemini API key.
Messages and responses are successfully processed, and readables work fine.
Copilot actions fail to trigger in my custom server setup.
Copilot actions work as expected when using the public Copilot Cloud API key.
Using LangChain adapter and CopilotKit runtime to manage interactions.

import express from "express";
import {
  CopilotRuntime,
  LangChainAdapter,
  copilotRuntimeNodeHttpEndpoint,
} from "@copilotkit/runtime";
import { ChatGoogleGenerativeAI } from "@langchain/google-genai";
import dotenv from "dotenv";

dotenv.config();

const app = express();
const model = new ChatGoogleGenerativeAI({
  model: "gemini-1.5-flash",
  apiKey: process.env.GEMINI_API_KEY,
  region: "us-central1",
});

const serviceAdapter = new LangChainAdapter({
  chainFn: async ({ messages, tools }) => {
    return model.bindTools(tools).stream(messages);
  },
});

app.use("/copilotkit", (req, res, next) => {
  const runtime = new CopilotRuntime();
  const handler = copilotRuntimeNodeHttpEndpoint({
    endpoint: "/copilotkit",
    runtime,
    serviceAdapter,
  });

  return handler(req, res, next);
});

app.listen(4000, () => {
  console.log("Listening at http://localhost:4000/copilotkit");
});

Everything works perfectly when I use the copilot-cloud-public-api-key. Features like messages, useCopilotReadable, and useCopilotAction function as expected. However, when switching to self-hosting with the LangChain adapter and GEMINI_API_KEY, only messages and useCopilotReadable work correctly. While the AI can respond based on the readable data, useCopilotAction doesn’t trigger at all.