#No matching export in "convex.json" for import "workflow"

1 messages · Page 1 of 1 (latest)

merry latch
#

why am i gettig this error?

tepid sorrelBOT
#

Hi @merry latch. I'm kapa.ai, your friendly support bot. I will try to answer your question by searching through the knowledge base. :wave:

#

It looks like you're encountering an error related to importing the workflow component in Convex. This error typically occurs when you're trying to use the workflow component but haven't properly set it up.

Based on the knowledge sources, here's how to fix this issue:

  1. First, make sure you've installed the workflow component:
npm install @convex-dev/workflow
  1. Then, you need to configure the component in your convex/convex.config.ts file:
// convex/convex.config.ts
import workflow from "@convex-dev/workflow/convex.config";
import { defineApp } from "convex/server";

const app = defineApp();
app.use(workflow);
export default app;
  1. Finally, create a workflow manager in your Convex folder:
// convex/index.ts
import { WorkflowManager } from "@convex-dev/workflow";
import { components } from "./_generated/api";

export const workflow = new WorkflowManager(components.workflow);

The error "No matching export in 'convex.json' for import 'workflow'" suggests that you might be trying to use the workflow component without completing these setup steps, particularly the configuration in convex.config.ts.

After setting up the component properly, you should be able to define and use workflows in your Convex application as shown in the Workflow component documentation.

I hope this helps! Let me know if you have any other questions about setting up workflows in Convex.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@merry latch Kapa.ai is still learning and improving, please let me know how I did by reacting below.

merry latch
#

i already setup workflow properly @tepid sorrel

// convex/index.ts
import { WorkflowManager } from "@convex-dev/workflow";
import { components } from "./_generated/api";

export const workflow = new WorkflowManager(components.workflow, {
  workpoolOptions: {
    maxParallelism: 30,
  },
});

and this is my convex.json

{
  "node": {
    "externalPackages": [ "sharp"]
  }
}
tepid sorrelBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

I see the issue now. You're missing a convex.config.ts file, which is different from your convex.json file.

Based on the workflow component documentation, you need to create a convex.config.ts file in your Convex folder to properly set up the workflow component:

// convex/convex.config.ts
import workflow from "@convex-dev/workflow/convex.config";
import { defineApp } from "convex/server";

const app = defineApp();
app.use(workflow);
export default app;

Your convex.json file is correctly set up for external packages (like sharp), but it doesn't handle component configuration. The workflow component needs to be registered using the app.use() method in a convex.config.ts file as shown above.

After creating this file and running npx convex dev, the workflow component should be properly registered and available for use in your application.

For more details on setting up the workflow component, you can refer to the Workflow component documentation.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon:

#

@merry latch Kapa.ai is still learning and improving, please let me know how I did by reacting below.

merry latch
#

@tepid sorrel i have it as well

// convex/convex.config.ts
import workflow from "@convex-dev/workflow/convex.config";
import { defineApp } from "convex/server";

const app = defineApp();
app.use(workflow);
export default app;

// convex/convex.config.ts
tepid sorrelBOT
#

Let me check the knowledge base for you again. One moment! :books:

#

I see that you have the correct convex.config.ts file set up. Based on the error message "No matching export in 'convex.json' for import 'workflow'" and the information provided, there could be a few issues:

  1. You might need to restart your Convex development server after adding the configuration. Try running npx convex dev again.

  2. There could be an issue with the generated code. Try running npx convex dev to regenerate the API files.

  3. You might be experiencing a module resolution issue. Several users in the knowledge sources have reported similar "Could not resolve" errors with components. Some potential solutions:

    • Check your TypeScript configuration. Some users have resolved similar issues by adjusting their tsconfig.json settings, particularly the moduleResolution setting as mentioned in this Discord thread.

    • Make sure you're using a compatible Node.js version. One user reported fixing a component-related issue by switching from Node v23.0.0 to v20.18.0 as noted in this thread.

  4. There might be a path issue with the import. Double-check that the import path @convex-dev/workflow/convex.config is correct. Some components had path issues that were fixed in updates.

If you're still experiencing issues, could you share the full error message and the version of Convex and Node.js you're using? This would help narrow down the problem further.

Also, make sure you've run npm install @convex-dev/workflow in your project directory to install the workflow component.

Note: you can ask me a follow up question by @ mentioning me again :speech_balloon: