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
Copy file name to clipboardExpand all lines: src/content/docs/sandbox/configuration/environment-variables.mdx
-4Lines changed: 0 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -296,10 +296,6 @@ wrangler secret put AWS_SECRET_ACCESS_KEY
296
296
# Paste your R2 Secret Access Key
297
297
```
298
298
299
-
:::caution[Production only]
300
-
Bucket mounting requires production deployment. It does not work with `wrangler dev` due to FUSE support limitations. See [Mount buckets guide](/sandbox/guides/mount-buckets/) for details.
301
-
:::
302
-
303
299
**Mount buckets with automatic credential detection:**
Mount S3-compatible object storage buckets as local filesystem paths. Access object storage using standard file operations.
12
12
13
13
:::note[S3-compatible providers]
14
14
The SDK works with any S3-compatible object storage provider. Examples include Cloudflare R2, Amazon S3, Google Cloud Storage, Backblaze B2, MinIO, and [many others](https://github.com/s3fs-fuse/s3fs-fuse/wiki/Non-Amazon-S3). The SDK automatically detects and optimizes for R2, S3, and GCS.
15
15
:::
16
16
17
-
:::caution[Production only]
18
-
Bucket mounting does not work with `wrangler dev` because it requires FUSE support that wrangler does not currently provide. Deploy your Worker with `wrangler deploy` to use this feature. All other Sandbox SDK features work in local development.
You can mount R2 buckets during local development with `wrangler dev` by passing the `localBucket` option. This uses the R2 binding from your Worker environment directly, so no S3-compatible endpoint or credentials are required.
152
+
153
+
### Configure R2 bindings
154
+
155
+
Add an R2 bucket binding to your Wrangler configuration:
156
+
157
+
<WranglerConfig>
158
+
```jsonc
159
+
{
160
+
"r2_buckets": [
161
+
{
162
+
"binding":"MY_BUCKET",
163
+
"bucket_name":"my-test-bucket"
164
+
}
165
+
]
166
+
}
167
+
```
168
+
</WranglerConfig>
169
+
170
+
### Mount with `localBucket`
171
+
172
+
Pass `localBucket: true` in the options to mount the bucket locally:
You can use an environment variable to toggle `localBucket` between local development and production. Set an environment variable such as `LOCAL_DEV` in your Wrangler configuration using `vars` for local development, then reference it in your code:
When `localBucket` is `true`, the `endpoint` is ignored and the SDK uses the R2 binding directly. For more information on setting environment variables, refer to [Environment variables in Wrangler configuration](/workers/configuration/environment-variables/).
197
+
:::
198
+
199
+
The `readOnly` and `prefix` options work the same way in local mode:
During local development, files are synchronized between R2 and the container using a periodic sync process rather than a direct filesystem mount. Keep the following in mind:
220
+
221
+
-**Synchronization window** - A brief delay exists between when a file is written and when it appears on the other side. For example, if you upload a file to R2 and then immediately read it from the mounted path in the container, the file may not yet be available. Allow a short window for synchronization to complete before reading recently written data.
222
+
-**High-frequency writes** - Rapid successive writes to the same file path may take slightly longer to fully propagate. For best results, avoid writing to the same file from both R2 and the container at the same time.
223
+
-**Bidirectional sync** - Changes made in the container are synced to R2, and changes made in R2 are synced to the container. Both directions follow the same periodic sync model.
224
+
225
+
:::note
226
+
These considerations apply to local development with `wrangler dev` only. In production, bucket mounts use a direct filesystem mount with no synchronization delay.
Copy file name to clipboardExpand all lines: src/content/docs/sandbox/tutorials/persistent-storage.mdx
+2-8Lines changed: 2 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -176,13 +176,7 @@ Try this flow:
176
176
Replace `YOUR_ACCOUNT_ID` in the endpoint URL with your Cloudflare account ID. Find it in the [dashboard](https://dash.cloudflare.com/) under **R2** > **Overview**.
177
177
:::
178
178
179
-
## 4. Local development limitation
180
-
181
-
:::caution[Requires production deployment]
182
-
Bucket mounting does not work with `wrangler dev` because it requires FUSE support that wrangler does not currently provide. You must deploy to production to test this feature. All other Sandbox SDK features work locally - only `mountBucket()` and `unmountBucket()` require production deployment.
183
-
:::
184
-
185
-
## 5. Deploy to production
179
+
## 4. Deploy to production
186
180
187
181
**Generate R2 API tokens:**
188
182
1. Go to **R2** > **Overview** in the [Cloudflare dashboard](https://dash.cloudflare.com/)
@@ -210,7 +204,7 @@ npx wrangler deploy
210
204
211
205
After deployment, wrangler outputs your Worker URL (e.g., `https://data-pipeline.yourname.workers.dev`).
212
206
213
-
## 6. Test the persistence flow
207
+
## 5. Test the persistence flow
214
208
215
209
Now test against your deployed Worker. Replace `YOUR_WORKER_URL` with your actual Worker URL:
0 commit comments