yantakus
yantakus2w ago

Build error with @blocknote/server-util (local dev)

I need to run the following function in an action:
import { ServerBlockNoteEditor } from "@blocknote/server-util";

async function mdToBlocks(md: string) {
const editor = ServerBlockNoteEditor.create();
return await editor.tryParseMarkdownToBlocks(md);
}
import { ServerBlockNoteEditor } from "@blocknote/server-util";

async function mdToBlocks(md: string) {
const editor = ServerBlockNoteEditor.create();
return await editor.tryParseMarkdownToBlocks(md);
}
I get the following error:
✖ Error fetching POST http://127.0.0.1:3210/api/deploy2/start_push 400 Bad Request: InvalidModules: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Uncaught Failed to analyze documentProcessing.js: Cannot find module './xhr-sync-worker.js'
Require stack:
- /var/folders/w6/z0sxl_zd06v2qdqn9mj0k2z40000gn/T/.tmp5IOhGh/source/f7a02a56-a276-4817-8a44-a4c2828aeac8/modules/_deps/node/25VZDILB.js
at <anonymous> (../node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js:36:2)
at <anonymous> (convex:/user/_deps/node/V7X2J7BI.js:13:31)
at <anonymous> (../node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequest.js:654:13)
at <anonymous> (convex:/user/_deps/node/V7X2J7BI.js:13:31)
at <anonymous> (../node_modules/jsdom/lib/jsdom/living/interfaces.js:170:13)
at <anonymous> (convex:/user/_deps/node/V7X2J7BI.js:13:31)
at <anonymous> (../node_modules/jsdom/lib/jsdom/browser/Window.js:32:8)
at <anonymous> (convex:/user/_deps/node/V7X2J7BI.js:13:31)
✖ Error fetching POST http://127.0.0.1:3210/api/deploy2/start_push 400 Bad Request: InvalidModules: Hit an error while pushing:
Loading the pushed modules encountered the following
error:
Uncaught Failed to analyze documentProcessing.js: Cannot find module './xhr-sync-worker.js'
Require stack:
- /var/folders/w6/z0sxl_zd06v2qdqn9mj0k2z40000gn/T/.tmp5IOhGh/source/f7a02a56-a276-4817-8a44-a4c2828aeac8/modules/_deps/node/25VZDILB.js
at <anonymous> (../node_modules/jsdom/lib/jsdom/living/xhr/XMLHttpRequest-impl.js:36:2)
at <anonymous> (convex:/user/_deps/node/V7X2J7BI.js:13:31)
at <anonymous> (../node_modules/jsdom/lib/jsdom/living/generated/XMLHttpRequest.js:654:13)
at <anonymous> (convex:/user/_deps/node/V7X2J7BI.js:13:31)
at <anonymous> (../node_modules/jsdom/lib/jsdom/living/interfaces.js:170:13)
at <anonymous> (convex:/user/_deps/node/V7X2J7BI.js:13:31)
at <anonymous> (../node_modules/jsdom/lib/jsdom/browser/Window.js:32:8)
at <anonymous> (convex:/user/_deps/node/V7X2J7BI.js:13:31)
The file where the action is declared is marked with "use node" directive. How do I make it work? Thanks.
14 Replies
Convex Bot
Convex Bot2w ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
Clever Tagline
The file where the action is declared is marked with "use node" directive.
Is the function you listed above in the same file as the action? If not, try adding the "use node" directive there as well. Not 100% sure if this will change anything, but it might be worth a try. I'm in the early stages of adding a feature that sounds similar to yours, and the file where I need an extra package is separate from the file containing the action that will call it. I might get to testing that today, and I'll let you know what I find.
yantakus
yantakusOP2w ago
@Clever Tagline thanks for your advice, but unfortunately it doesn't help. I even moved the function together with @blocknote/server-util import into the file with actions and still getting the error.
Clever Tagline
Thanks for the update. I'm not yet at a point where I can test my setup. Out of curiosity, is this a local Convex deployment or a cloud deployment?
yantakus
yantakusOP2w ago
@Clever Tagline local
Clever Tagline
Gotcha. Unfortunately I don't have experience self-hosting Convex, and something tells me that might play into this issue. If you haven't already done so, I recommend posting in the #self-hosted channel. I'll update the title of this post as well, and perhaps between the two someone can help you figure this out.
erquhart
erquhart2w ago
Local as in you selected local dev but you're still using the cloud product/dashboard, or local as in self-hosted, where you run a docker container with your convex deployment? In either case, though, this is likely a bug that would also happen in the cloud offering. Can you share more of the relevant code, like the action that calls the node action, and the node action itself?
Clever Tagline
I meant to say “self-hosted,” but my brain couldn’t generate the phrase at the time. Must’ve given it the wrong prompt. 😣
yantakus
yantakusOP2w ago
@erquhart yes, "selected local dev but using the cloud product/dashboard". There's actually no more code to share. I get this error when trying to build the app (convex dev). I don't have an action to trigger this yet. I thought this happens because @blocknote/server-util or it's dependency jsdom that actually triggers build error are not compatible with node 18 which is required for local development, but this seems not to be the case: https://www.npmjs.com/package/@blocknote/server-util?activeTab=code - depends on jsdom 25.0.1 https://www.npmjs.com/package/jsdom/v/25.0.1?activeTab=code - has "node": ">=18"
erquhart
erquhart2w ago
The code you shared, is it in a file with the "use node" directive at the top?
yantakus
yantakusOP4d ago
@erquhart yes, it is in a file with "use node" directive
yantakus
yantakusOP3d ago
@erquhart adding jsdom to externalPackages gives the same error as in my initial message in this thread. Adding @blocknote/server-util fails with
✖ Error fetching POST http://127.0.0.1:3210/api/deploy2/start_push 400 Bad Request: ModulesTooLarge: Hit an error while pushing:
Total module size exceeded the zipped maximum (58.17 MiB > maximum size 42.92 MiB)
✖ Error fetching POST http://127.0.0.1:3210/api/deploy2/start_push 400 Bad Request: ModulesTooLarge: Hit an error while pushing:
Total module size exceeded the zipped maximum (58.17 MiB > maximum size 42.92 MiB)
erquhart
erquhart3d ago
Don't add @blocknote/server-util to externals. Maybe jsdom and canvas together - this issue seems to be common with jsdom and esbuild (which convex uses underneath), some folks used patches but hopefully externals can be enough: https://github.com/evanw/esbuild/issues/1311#issuecomment-2766631083 The issue is four years old but comments are still coming in from folks affected

Did you find this page helpful?