Skip to content

Commit a8df1cf

Browse files
Version Packages (#877)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
1 parent 0b8ead9 commit a8df1cf

File tree

5 files changed

+71
-53
lines changed

5 files changed

+71
-53
lines changed

.changeset/tiny-cups-push.md

Lines changed: 0 additions & 51 deletions
This file was deleted.

packages/blob/CHANGELOG.md

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,67 @@
11
# @vercel/blob
22

3+
## 2.0.0
4+
5+
### Major Changes
6+
7+
- 0b8ead9: **BREAKING CHANGE:**
8+
9+
To continue receiving `onUploadCompleted` callback once a file is uploaded with Client Uploads when **not hosted on Vercel**, you need to provide the `callbackUrl` at the `onBeforeGenerateToken` step when using `handleUpload`.
10+
11+
**When hosted on Vercel:**
12+
No code changes required. The `callbackUrl` is inferred from [Vercel system environment variables](https://vercel.com/docs/environment-variables/system-environment-variables):
13+
14+
- In preview environment: `VERCEL_BRANCH_URL` when available, otherwise `VERCEL_URL`
15+
- In production environment: `VERCEL_PROJECT_PRODUCTION_URL`
16+
17+
If you're not hosted on Vercel or you're not using Vercel system environment variables, your will need to provide the `callbackUrl`:
18+
19+
**Before:**
20+
21+
```ts
22+
await handleUpload({
23+
body,
24+
request,
25+
onBeforeGenerateToken: async (pathname) => {
26+
/* options */
27+
},
28+
onUploadCompleted: async ({ blob, tokenPayload }) => {
29+
/* code */
30+
},
31+
});
32+
```
33+
34+
**After:**
35+
36+
```ts
37+
await handleUpload({
38+
body,
39+
request,
40+
onBeforeGenerateToken: async (pathname) => {
41+
return { callbackUrl: 'https://example.com' }; // the path to call will be automatically computed
42+
},
43+
onUploadCompleted: async ({ blob, tokenPayload }) => {
44+
/* code */
45+
},
46+
});
47+
```
48+
49+
**For local development:**
50+
Set the `VERCEL_BLOB_CALLBACK_URL` environment variable to your tunnel URL:
51+
52+
```bash
53+
VERCEL_BLOB_CALLBACK_URL=https://abc123.ngrok-free.app
54+
```
55+
56+
See the updated documentation at https://vercel.com/docs/vercel-blob/client-upload to know more.
57+
58+
**Details:**
59+
60+
Before this commit, during Client Uploads, we would infer the `callbackUrl` at the client side level (browser) based on `location.href` (for convenience).
61+
This is wrong and allows browsers to redirect the onUploadCompleted callback to a different website.
62+
63+
While not a security risk, because the blob urls are already public and the browser knows them, it still pose a risk of database drift if you're relying on onUploadCompleted callback to update any system on your side.
64+
365
## 1.1.1
466

567
### Patch Changes

packages/blob/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vercel/blob",
3-
"version": "1.1.1",
3+
"version": "2.0.0",
44
"description": "The Vercel Blob JavaScript API client",
55
"homepage": "https://vercel.com/storage/blob",
66
"repository": {

test/next/CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
# vercel-storage-integration-test-suite
22

3+
## 0.3.10
4+
5+
### Patch Changes
6+
7+
- Updated dependencies [0b8ead9]
8+
- @vercel/blob@2.0.0
9+
310
## 0.3.9
411

512
### Patch Changes

test/next/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "vercel-storage-integration-test-suite",
3-
"version": "0.3.9",
3+
"version": "0.3.10",
44
"private": true,
55
"scripts": {
66
"build": "next build",

0 commit comments

Comments
 (0)