NextJS+Wrangler+R2 setup for local development without remote bucket

I'm building a little SaaS app, which I've now got in state that I would like to implement file upload into it. I've successfully implemented that, by having local environment using r2_buckets-binding with remote: true flag. The challenge is that my CI/CD pipeline breaks in github actions, since having that remote flag in wrangler.jsonc file, requires that my Github instance is logged into Cloudflare with my account, instead of using account API key. What might be the proper way to develop and test R2 bucket uploads locally with NextJS, but still being able to setup staging and production environments properly into wrangler.jsonc? My NextJS is setup based on cloudflare NextJS template. So NextJS config has
import { initOpenNextCloudflareForDev } from "@opennextjs/cloudflare";
initOpenNextCloudflareForDev();
import { initOpenNextCloudflareForDev } from "@opennextjs/cloudflare";
initOpenNextCloudflareForDev();
And dev script is: next dev --turbopack And for CD in github action, I've Cloudflare API key set, and command opennextjs-cloudflare build && opennextjs-cloudflare deploy --env staging
0 Replies
No replies yetBe the first to reply to this messageJoin

Did you find this page helpful?