Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat!: add region parameter #183

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

Merged
eduardoboucas merged 3 commits into main from feat/add-region-parameter
Jul 3, 2024
Merged

Conversation

Copy link
Member

@eduardoboucas eduardoboucas commented Jul 3, 2024

Which problem is this pull request solving?

In #158, we've added experimental support for configurable regions to deploy-scoped stores (i.e. stores created with getDeployStore()). It works as follows:

  • For API calls (i.e. when using an API token), you can use getDeployStore({ experimentalRegion: "auto" }) to instruct the API to choose the same region as the one configured for functions
    • If this parameter is not supplied, the Blobs client will not send any region parameter to the API, which means the default region will be used
  • For edge calls (i.e. when using a token from a serverless function or an edge function), you can use getDeployStore({ experimentalRegion: "context" }) to instruct the CDN to choose the region defined in the environment
    • If a region is not defined in the environment, an error will be thrown
    • This should not happen, since we're populating the environment with a region in all contexts (serverless functions, edge functions, and the CLI)

This PR introduces the following changes:

  • The experimentalRegion parameter is removed
  • A new region parameter is added to the getDeployStore method, which takes the name of a region
  • For API calls, a region is now always sent to the API
    • If a region has been specified via the region parameter, that will be used
    • If not, the client will use auto
  • For edge calls, a region is now always sent to the CDN
    • If a region has been specified via the region parameter, that will be used
    • If not, the region specified in the context will be used, if one is set
    • If not, an error will be thrown

Technically, this is a breaking change because getDeployStore() now selects the functions region by default instead of the default region, accessing the same store using different versions of the Blobs client might generate different reasons, since they may be pointing to different regions.

Should you want to update your Blobs client but keep accessing a deploy-scoped store that has been created with an older version, you can use getDeployStore({ region: "us-east-2" }) to ensure you're using the right region.

@eduardoboucas eduardoboucas requested a review from a team as a code owner July 3, 2024 12:27
Copy link

netlify bot commented Jul 3, 2024
edited
Loading

Deploy Preview for blobs-js ready!

Name Link
🔨 Latest commit 234c280
🔍 Latest deploy log https://app.netlify.com/sites/blobs-js/deploys/6685452122a620000894e837
😎 Deploy Preview https://deploy-preview-183--blobs-js.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@github-actions github-actions bot added the type: feature code contributing to the implementation of a feature and/or user facing functionality label Jul 3, 2024
@eduardoboucas eduardoboucas deleted the feat/add-region-parameter branch July 3, 2024 13:49
serhalp added a commit to serhalp/unstorage that referenced this pull request Sep 15, 2024
The peer dependency only specifies support for v6 and v7, but v8 works
just fine.
This adds v8 to the peer dependencies, bumps the dev dep to v8, updates
the tests (there's a new requirement that's specific to unusual use
cases like unstorage's tests, which are run outside of the Netlify
platform and the Netlify CLI), and adjust the driver types to ensure
compatibility with all supported versions.
See netlify/blobs#183.
I believe @netlify/blobs@8 will error in local dev when using
netlify-cli before 17.21.1. This doesn't seem like unstorage's problem
though, so I didn't do anything about that here.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
1 more reviewer

@JGAntunes JGAntunes JGAntunes approved these changes

Reviewers whose approvals may not affect merge requirements
Assignees
No one assigned
Labels
type: feature code contributing to the implementation of a feature and/or user facing functionality
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /