Deploying Bolt.diy with Cloudflare Pages (the easy way!)

I would need to know more, but it looks like a cache error which is generally an issue with the build command. Double check you followed the instructions correctly and re-deploy the Cloudflare instance.

doesn’t work anymore

I recently re-deployed and instance and it still works. You just need to make sure you follow all of the steps.

1 Like

I did follow all the steps. I even forked it again and re did the whole thing, still the same. I have deleted the 2 files, set the thingy to stable (deleted files in the stable part of the fork), then uploaded it to cloudflare and did the startup command.

The weird thing is that it didn’t crash on the first build. Every other video and your guide had crashed with an error on the first build (which you fix by going to run time and doing some stuff), but mine was successful on the first build

I can’t know for sure without more details, but it sounds like you may have not set both of the compatibility flags?

There were 2 flags? I thought it was just nodejs_compat

There is also the compatibility date, but it SHOULD work without it. The nodejs_compat flag is the important one. I’ll test a clean copy with the latest (appears to be v0.0.6) version and see. I don’t expect to run into any problems though as mine has updated fine without issue.

Version
fae668e(v0.0.6) - nightly

Update: Just tried this and I tried to re-deploy a deployment that had already failed (because I deleted the wrangler.toml and .tool-versions first). It gave me issues and I received a strange error:

Your Worker may throw errors at runtime unless you enable the "nodejs_compat" compatibility flag.

Alternatively, then, I just re-deployed by modifying a file in the repo (literally just added a line to a file and committed the changes), AFTER deploying to Cloudflare Pages, and it worked. So, the “Retry Deployment” is arguably in the wrong order.

So, the cleaner method would be to deploy to Cloudflare first, and then delete the files mentioned. Hope that helps!

1 Like

I am still getting this issue, that fly mentioned, I deleted the files but still its the same issue.

Hey, could you please elaborate on that or provide a source or tutorial?
I would really appreciate it.

There are actually a few ways. You can use Trae which comes with Claude 3.5 Sonnet for free, there’s a few API platforms that offered it for free and free credits, etc. But my specific “hacky” solution was using Puter who offers a JavaScript library for accessing Claude 3.5 Sonnet, see their article:

Free, Unlimited Claude 3.5 Sonnet API

I created a prototype wrapper to make an OpenAI-like endpoint to bring into Windsurf and Bolt.diy for testing. I have the code, but it’s not well refined and I really only used it to test. I mostly use DeepSeek-R1 and variants at this point though with RAG. That and I’ve really been liking Qwen Chat (DeepSeek Chat is great when it works).

If there was some interest and maybe someone wanted to help me with the project to maintain it, I’d be happy to polish what I have to share under MIT, along with a free API anyone could use (with maybe option to sign in for a dedicated instance but still free). The only concern I have is that if it got a lot of interest, Puter may discontinue the offering, but idk.

I have the stable version running on Cloudfare fine but was trying to get the main branch running on there. I tried with deleting the 2 files before deployment and after with no success. I did the nodejs_compat and tried changing the Compatibility date and not changing with the same results. Here is the errors shown on Cloudfare. Above you noted you modified a file and it worked, didnt know if modifing such file would work for my issue also.
[ERROR] Build failed with 5 errors:
15:17:57.453
15:17:57.453 ✘ [ERROR] Could not resolve “child_process”
15:17:57.453
15:17:57.453 …/build/server/index.js:25:31:
15:17:57.454 25 │ import { execSync, exec } from ‘child_process’;
15:17:57.454 ╵ ~~~~~~~~~~~~~~~
15:17:57.454
15:17:57.454 The package “child_process” wasn’t found on the file system but is built into node.
15:17:57.454 - Make sure to prefix the module name with “node:” or update your compatibility_date to 2024-09-23 or later.
15:17:57.454
15:17:57.454
15:17:57.454
15:17:57.454 ✘ [ERROR] Could not resolve “crypto”
15:17:57.454
15:17:57.454 …/build/server/index.js:29:19:
15:17:57.455 29 │ import crypto from ‘crypto’;
15:17:57.455 ╵ ~~~~~~~~
15:17:57.455
15:17:57.455 The package “crypto” wasn’t found on the file system but is built into node.
15:17:57.455 - Make sure to prefix the module name with “node:” or update your compatibility_date to 2024-09-23 or later.
15:17:57.455
15:17:57.455
15:17:57.455
15:17:57.456 ✘ [ERROR] Could not resolve “util”
15:17:57.456
15:17:57.456 …/build/server/index.js:31:26:
15:17:57.456 31 │ import { promisify } from ‘util’;
15:17:57.456 ╵ ~~~~~~
15:17:57.456
15:17:57.457 The package “util” wasn’t found on the file system but is built into node.
15:17:57.457 - Make sure to prefix the module name with “node:” or update your compatibility_date to 2024-09-23 or later.
15:17:57.457
15:17:57.457
15:17:57.457
15:17:57.457 ✘ [ERROR] Could not resolve “crypto”
15:17:57.457
15:17:57.457 …/node_modules/.pnpm/cookie-signature@1.2.2/node_modules/cookie-signature/index.js:5:21:
15:17:57.457 5 │ var crypto = require(‘crypto’);
15:17:57.457 ╵ ~~~~~~~~
15:17:57.458
15:17:57.458 The package “crypto” wasn’t found on the file system but is built into node.
15:17:57.458 - Make sure to prefix the module name with “node:” or update your compatibility_date to 2024-09-23 or later.
15:17:57.458
15:17:57.458
15:17:57.458
15:17:57.458 ✘ [ERROR] Could not resolve “stream”
15:17:57.458
15:17:57.458 …/node_modules/.pnpm/stream-slice@0.1.2/node_modules/stream-slice/index.js:3:24:
15:17:57.458 3 │ var Transform = require(‘stream’).Transform;
15:17:57.459 ╵ ~~~~~~~~
15:17:57.459
15:17:57.459 The package “stream” wasn’t found on the file system but is built into node.
15:17:57.459 - Make sure to prefix the module name with “node:” or update your compatibility_date to 2024-09-23 or later.
15:17:57.459

I was able to replicate your issue. Looks like there’s an issue with the current build version. It almost implies that the required modules are not installed but I have to dig deeper (deploying to Cloudflare won’t provide enough information here to debug).

I’m testing now.

Update: It’s yet to be seen, but it appears that Cloudflare pushed a bunch of changes, and now the options are completely different. So, the issues might not be due to Bolt.diy itself. Working through the steps and will update on progress.

5 Likes

Tried to sync fork and update to the latest version - but unfortunately didn’t work for me :frowning: Something happened recently ? Any new build commands that need to be used inside CloudFlare ?


23:58:24.360 ✘ [ERROR] Could not resolve crypto
23:58:24.361
23:58:24.361 …/build/server/index.js:29:19:
23:58:24.361 29 │ import crypto from ‘crypto’;
23:58:24.361 ╵ ~~~~~~~~
23:58:24.361
23:58:24.361 The package crypto wasn’t found on the file system but is built into node.
23:58:24.361 - Make sure to prefix the module name with node: or update your compatibility_date to 2024-09-23 or later.
23:58:24.361
23:58:24.361
23:58:24.362
23:58:24.362 ✘ [ERROR] Could not resolve util
23:58:24.362
23:58:24.362 …/build/server/index.js:31:26:
23:58:24.362 31 │ import { promisify } from ‘util’;
23:58:24.362 ╵ ~~~~~~
23:58:24.362
23:58:24.363 The package util wasn’t found on the file system but is built into node.
23:58:24.363 - Make sure to prefix the module name with node: or update your compatibility_date to 2024-09-23 or later.
23:58:24.363
23:58:24.363
23:58:24.363
23:58:24.363 ✘ [ERROR] Could not resolve crypto
23:58:24.364
23:58:24.364 …/node_modules/.pnpm/cookie-signature@1.2.2/node_modules/cookie-signature/index.js:5:21:
23:58:24.364 5 │ var crypto = require(‘crypto’);
23:58:24.364 ╵ ~~~~~~~~
23:58:24.364
23:58:24.364 The package crypto wasn’t found on the file system but is built into node.
23:58:24.364 - Make sure to prefix the module name with node: or update your compatibility_date to 2024-09-23 or later.
23:58:24.364
23:58:24.365
23:58:24.365
23:58:24.365 ✘ [ERROR] Could not resolve stream
23:58:24.365
23:58:24.365 …/node_modules/.pnpm/stream-slice@0.1.2/node_modules/stream-slice/index.js:3:24:
23:58:24.365 3 │ var Transform = require(‘stream’).Transform;
23:58:24.365 ╵ ~~~~~~~~
23:58:24.365
23:58:24.366 The package stream wasn’t found on the file system but is built into node.
23:58:24.366 - Make sure to prefix the module name with node: or update your compatibility_date to 2024-09-23 or later.

Hey @seblosiv,

known issue, see: How to upgrade bold.diy to v0.0.7 on cloudflare - #6 by leex279

(it broke with the new release 0.0.7, so not your fault/misstake)

1 Like

Hey, I am having this same error.

Any new fixes yet?

Hey Aliasfox, any new updates?

@JanLisy the fix is on the main branch and working again with cloudlfare. Stable hotfix coming soon.

Thank you leex, I am going to give it a go.

Saw a few of your videos btw, great work, appreciate your commitment to this helpful project.

I just need to figure out how to make it work reliably, because running it locally worked for a few hours and then it messed up everything, deleted a lot of my progress, even completely changed the design and functionality of the page and then it even stopped coding, it was just talking to me in the chat.

Going to give this a go, let’s see how its going to play out. Thanks again

1 Like

Thanks for the feedback :slight_smile:

This is not a problem of bolt itself. Thats more a general problem of the LLM, that they start to hallucinate and change stuff. I also got this with bolt.new some times.
A deployment to cloudflare will not change anything about this. Just changing the LLM you use. With Anthropic Claude Sonnet 3.7 I dont have this much.

2 Likes

100%. Deploying to Cloudflare Pages may resolve CORS/TLS/Mixed Content (HTTP vs HTTPS) issues though as you will generally run into these issues running things on Localhost (non-https).

@JanLisy As a note, it’s a good idea to pull from a GitHub repository and commit/push (or stash) changes when you are happy with them. This way if the AI screws things up, you have a point to roll back to. Additionally, GitHub Actions (generally on push) could run tests (linting, sanity check, unit tests, etc.) and you would want the AI to make the smallest iterative changes.

It feels kind of dumb at times, but it feels more like we are learning to use the AI than it learning to assist us. AI is a quirky system, good luck!

1 Like