Error: Failed to publish your Function. Got error: Uncaught Error: Dynamic require

For Workes & Pages, what is the name of the domain?

example.com

What is the issue or error you’re encountering

Error: Failed to publish your Function. Got error: Uncaught Error: Dynamic require of “node:crypto” is not supported.

What steps have you taken to resolve the issue?

  1. Added the nodejs_compat compatibility.
  2. Build
  3. Error
1 Like

What is the code in your project that is trying to use node:crypto?

Are you using module worker syntax? Importing these things may not work correctly on service worker syntax.

Also, you may find more help in the Cloudflare Developers Discord community: https://discord.gg/cloudflaredev

I had a similar error when using remix-run.
I found the solution is to make sure that I was importing the serverless versions of my framework dependances in my case from @remix-run/cloudflare instead of the node version from @remix-run/node

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.