© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
Cloudflare DevelopersCD
Cloudflare Developers•4mo ago
Maastonakki

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
r2_buckets
-binding with
remote: true
remote: true
flag. The challenge is that my CI/CD pipeline breaks in github actions, since having that remote flag in
wrangler.jsonc
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
staging
and
production
production
environments properly into
wrangler.jsonc
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
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
opennextjs-cloudflare build && opennextjs-cloudflare deploy --env staging
Cloudflare Developers banner
Cloudflare DevelopersJoin
Welcome to the official Cloudflare Developers server. Here you can ask for help and stay updated with the latest news
85,042Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

Wrangler R2 local emulation
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
3y ago
R2 Notification -> Queue -> Consumer in local development (wrangler.toml)
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
14mo ago
Use PGLite with Wrangler for local development
Cloudflare DevelopersCDCloudflare Developers / workers-and-pages-help
17mo ago