fix: allow siteID and token to be passed in Functions v2 and Edge Fun… #217
+13
−0
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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()
withsiteID
andtoken
(along withname
), I now pass these options togetClientOptions()
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