OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

Local Development: Cloudflare Worker (HonoJS) Accessing R2 Files

  • Thread starter Thread starter Aadesh Kulkarni
  • Start date Start date
A

Aadesh Kulkarni

Guest
I'm developing a Cloudflare Worker using HonoJS and leveraging Cloudflare R2 for object storage. In production, I've successfully enabled R2 Subdomain public access, allowing me to access files using the provided URL.

However, during local development (npm run dev), the uploaded files are stored within the codebase in .wrangler/state/../r2/Blob instead of the actual R2 bucket. This raises the question:

What mechanism can I use to access these files while running the Worker locally?

Is there a way to construct a local URL that mimics the production subdomain behavior, or is there a recommended approach for simulating R2 interaction during development?

Additional Information:

  • Tech stack: Cloudflare Worker (HonoJS), Cloudflare R2
  • I've explored using environment variables, but I'm unsure how to effectively configure them for this scenario.

Desired Outcome:

I'd like to find a solution that allows me to test my Worker's functionality with R2 file access during local development without compromising the security of the actual R2 objects.

<p>I'm developing a Cloudflare Worker using HonoJS and leveraging Cloudflare R2 for object storage. In production, I've successfully enabled R2 Subdomain public access, allowing me to access files using the provided URL.</p>
<p>However, during local development (<code>npm run dev</code>), the uploaded files are stored within the codebase in <code>.wrangler/state/../r2/Blob</code> instead of the actual R2 bucket. This raises the question:</p>
<p><strong>What mechanism can I use to access these files while running the Worker locally?</strong></p>
<p>Is there a way to construct a local URL that mimics the production subdomain behavior, or is there a recommended approach for simulating R2 interaction during development?</p>
<p><strong>Additional Information:</strong></p>
<ul>
<li>Tech stack: Cloudflare Worker (HonoJS), Cloudflare R2</li>
<li>I've explored using environment variables, but I'm unsure how to effectively configure them for this scenario.</li>
</ul>
<p><strong>Desired Outcome:</strong></p>
<p>I'd like to find a solution that allows me to test my Worker's functionality with R2 file access during local development without compromising the security of the actual R2 objects.</p>
 

Latest posts

Top