You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
RollupError with Cloudflare Pages Preset – Missing Semicolon in apiSwagger.js #3864
That doesn't allow deployments to Cloudflare. I currently have to wrap it with a Dockerfile and deploy it to a static Docker host with the node_server preset - which works, but means I can't use the performance and pricing from Cloudflare...
That doesn't allow deployments to Cloudflare. I currently have to wrap it with a Dockerfile and deploy it to a static Docker host with the node_server preset - which works, but means I can't use the performance and pricing from Cloudflare...
I ended up using the CF images transform by URL feature to transform my R2 stored images, instead of using sharp.
This is a bug in rollup because it should just not try to parse the string at all (it's trying to parse and process portions of a string, which is definitely not correcet). I've not researched further yet though.
If you want to hotfix this on your side and you are not using the swagger or scalar UIs, you could apply a patch to apiSwappger.js and apiScalar.js (pnpm patch @effect/platform) and empty those strings these files export.
Ok, dug a bit deeper. It's not that Rollup is trying to parse the string, but rather that something in the build pipeline is replacing typeof window globally (even within strings) with "undefined". If you can find out what the heck is doing that, then you'll have found the culprit and can fix it there. But this is indeed not a bug in effect.
This has been reported recently by another user too. I'd suggest to try and get this fixed in Nitro. The configuration for the rollup replace plugin is definitely overreaching and causing the problem here: nitrojs/nitro#3071
You can also hotfix this in your configuration by replacin the incorrect typeof window replacement with something that works better in this context. Note that this is imho not a true fix and can lead to problems elsewhere.
Thanks a lot for the great investigation and find! Now it fails at a different plugin, but at least that's a first-party dependency! Hopefully it's fixed on Rollup level!
Activity
JamesCullum commentedon Jan 26, 2025
Same issue, blocks all deployments to Cloudflare! Happy to hear if anyone found a workaround that still allows to deploy?
didagu commentedon Jan 26, 2025
workaround might be to deploy with node-server preset instead of cloudflare_pages preset.
JamesCullum commentedon Jan 28, 2025
That doesn't allow deployments to Cloudflare. I currently have to wrap it with a Dockerfile and deploy it to a static Docker host with the node_server preset - which works, but means I can't use the performance and pricing from Cloudflare...
didagu commentedon Jan 28, 2025
I ended up using the CF images transform by URL feature to transform my R2 stored images, instead of using sharp.
fubhy commentedon Jan 28, 2025
Can I get a simple reproduction (plain pre-configured github repo) to ease the debugging for me? Happy to look into that then.
JamesCullum commentedon Jan 29, 2025
Thanks for your support! I have set up a simple minimalistic starter project and installed uploadthing, which provokes this error by using the effect package. You can clone and test here: https://github.com/JamesCullum/effect-issue-3864
When you run "npm install" and "npm run build", you should encounter this issue.
JamesCullum commentedon Feb 16, 2025
@fubhy Any progress so far?
fubhy commentedon Feb 16, 2025
This is a bug in rollup because it should just not try to parse the string at all (it's trying to parse and process portions of a string, which is definitely not correcet). I've not researched further yet though.If you want to hotfix this on your side and you are not using the swagger or scalar UIs, you could apply a patch to
apiSwappger.jsandapiScalar.js(pnpm patch @effect/platform) and empty those strings these files export.fubhy commentedon Feb 16, 2025
Ok, dug a bit deeper. It's not that Rollup is trying to parse the string, but rather that something in the build pipeline is replacing
typeof windowglobally (even within strings) with "undefined". If you can find out what the heck is doing that, then you'll have found the culprit and can fix it there. But this is indeed not a bug in effect.fubhy commentedon Feb 16, 2025
It's this here: https://github.com/nitrojs/nitro/blob/722d586cd73417d6aafedacc799179a9743be12f/src/rollup/config.ts#L254
So it's a bug in nitro's rollup configuration it seems.
Replacing values globally and arbitrarily without considering the AST is generally not a good idea. Reaching into strings for that for sure isn't.
fubhy commentedon Feb 16, 2025
This has been reported recently by another user too. I'd suggest to try and get this fixed in Nitro. The configuration for the rollup replace plugin is definitely overreaching and causing the problem here: nitrojs/nitro#3071
You can also hotfix this in your configuration by replacin the incorrect
typeof windowreplacement with something that works better in this context. Note that this is imho not a true fix and can lead to problems elsewhere.JamesCullum commentedon Feb 16, 2025
Thanks a lot for the great investigation and find! Now it fails at a different plugin, but at least that's a first-party dependency! Hopefully it's fixed on Rollup level!