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

fix: allow siteID and token to be passed in Functions v2 and Edge Fun… #217

Open
wants to merge 6 commits into
base: main
Choose a base branch
from

Conversation

hrishikesh-k
Copy link
Contributor

@hrishikesh-k hrishikesh-k commented Feb 23, 2025

https://linear.app/netlify/issue/RUN-1401

When using Edge Functions or Functions v2, users could not specify a different site ID (along with the token) to store blobs on a different site. This was always fetched from the environment. This PR now allows that to happen. This was already possible in Functions v1 and any other Node.js application, so I didn't see any reason to penalize Edge Functions and Functions v2 users from doing the same. More details in Linear.

The solution for this already existed in the codebase but wasn't used. When calling getStore() with siteID and token (along with name), I now pass these options to getClientOptions() which automatically does what we need.

Initially I tried adding the check for siteID and token inside the if condition that handles name, but linter complained about nested if, so I had to split that condition into its own.

Checklist

  • I have read the contribution guidelines.
  • The status checks are successful (continuous integration). Those can be seen below.

@hrishikesh-k hrishikesh-k requested a review from a team as a code owner February 23, 2025 05:29
@github-actions github-actions bot added the type: bug code to address defects in shipped code label Feb 23, 2025
Copy link

netlify bot commented Feb 23, 2025

Deploy Preview for blobs-js ready!

Name Link
🔨 Latest commit de49b81
🔍 Latest deploy log https://app.netlify.com/sites/blobs-js/deploys/67babf3ef1f67f000837ab0e
😎 Deploy Preview https://deploy-preview-217--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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: bug code to address defects in shipped code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant