@opennextjs/cloudflare v1.6.3 .open-next/assets/index.html Bug?

I get a clean build in my local dev environment with "opennextjs-cloudflare build && opennextjs-cloudflare preview --port 8789" but the generated file ".open-next/assets/index.html" references the wrong chunk files. Is there possibly a bug here in v1.6.3 (latest as of this writing). For example, .open-next/assets/index.html refers to webpack-b0bd85f5ab45543e.js. However, this file is not in the build; rather, webpack-57c771ad3d897bce.js is there instead (in .open-next/assets/_next/static/chunks/). I chose the webpack file for this example because there's only one of them. I'm also getting this error for about 30 other chunk files. The browser gives me a 404 error for webpack-b0bd85f5ab45543e.js and renders nothing, and the curl command shows a 404 as well but returns a bunch of unrelated gibberish. The browser pulls up webpack-57c771ad3d897bce.js correctly, as does curl. I'm using R2 incremental cache. Because the content comes up just fine with "next dev -p 3001" I tried disabling R2 cache, but it didn't fix the problem. I'm also seeing this issue in my Cloudflare Worker in production. I had all this working when I build a skeleton project, but I've been seeing this issue ever since I migrated my code from Cloudflare Pages with NextJs and removed all the edge runtime exports, which brought me from 5 static pages to 115. Any thoughts? Please don't tell me to delete .next and .open-next, check my wrangler.jsonc and open-next.config.ts, turn off build cache everyhere, etc. and try to build again, because that's all I've been doing for the last two days. TIA.
1 Reply
Philip Lowden
Philip LowdenOP4w ago
This issue was fixed by enabling skew protection per https://opennext.js.org/cloudflare/howtos/skew, which I was able to use because I'm not using Durable Objects for Preview URLs in this worker (there's apparently a limitation to this at the moment).

Did you find this page helpful?