Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(deps): support @netlify/blobs v8 #486

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@azure/storage-blob": "^12.24.0",
"@capacitor/preferences": "^6.0.2",
"@cloudflare/workers-types": "^4.20240903.0",
"@netlify/blobs": "^7.4.0",
"@netlify/blobs": "^8.0.1",
"@planetscale/database": "^1.19.0",
"@types/ioredis-mock": "^8.2.5",
"@types/jsdom": "^21.1.7",
Expand Down Expand Up @@ -105,7 +105,7 @@
"@azure/keyvault-secrets": "^4.8.0",
"@azure/storage-blob": "^12.24.0",
"@capacitor/preferences": "^6.0.2",
"@netlify/blobs": "^6.5.0 || ^7.0.0",
"@netlify/blobs": "^6.5.0 || ^7.0.0 || ^8.0.0",
"@planetscale/database": "^1.19.0",
"@upstash/redis": "^1.34.0",
"@vercel/kv": "^1.0.1",
Expand Down
10 changes: 5 additions & 5 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions src/drivers/netlify-blobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,19 @@ export interface NetlifyDeployStoreOptions extends NetlifyBaseStoreOptions {
deployID?: string;
}

export interface NetlifyDeployStoreV8Options extends NetlifyDeployStoreOptions {
// TODO(serhalp) Export this type from @netlify/blobs instead
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll leave this PR as a draft until I address this.

region?: "us-east-1" | "us-east-2";
}

export interface NetlifyNamedStoreOptions extends NetlifyBaseStoreOptions {
name: string;
deployScoped?: false;
}

export type NetlifyStoreOptions =
| NetlifyDeployStoreOptions
| NetlifyDeployStoreV8Options
| NetlifyNamedStoreOptions;

export default defineDriver((options: NetlifyStoreOptions) => {
Expand Down
2 changes: 2 additions & 0 deletions test/drivers/netlify-blobs.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ describe("drivers: netlify-blobs", async () => {
token,
siteID,
deployID: "test",
// Usually defaulted via the environment; only required in a test environment like this
region: "us-east-1",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a fallback behavior if there is no env & default set?

Copy link
Author

@serhalp serhalp Sep 17, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No, it bails. But that should only be possible when running outside of the Netlify platform or the Netlify CLI (which means Netlify Blobs wouldn't work anyway... so you wouldn't even get to here), or like I mentioned in the PR description if you're using an old version of the Netlify CLI (<17.21.1).

I'll look into making that error more actionable though. It should ideally tell users to upgrade to netlify-cli@latest if they're running through the CLI, instead of just saying region is missing.

}),
});

Expand Down