StarLordS
Convex Community4mo ago
1 reply
StarLord

How can I use baml client in convex function?

I have 'use node'; in file where i use the client and my convex.json is as follows
{
  "functions": "src/convex/",
  "node": {
    "externalPackages": [
      "@boundaryml/baml"
    ]
  }
}

I am not able to deploy my convex function with baml client due the following error
Loading the pushed modules encountered the following
    error:
Uncaught Failed to analyze workflows/agents.js: Cannot find native binding. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.

I get the following error after I clear node modules and lock file and try to deploy
Loading the pushed modules encountered the following
    error:
Uncaught Failed to analyze workflows/agents.js: Cannot read properties of undefined (reading 'fromFiles')
    at <anonymous> (../../src/baml_client/globals.ts:30:4)

Is there a way to run baml client in convex function?
Was this page helpful?