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: support Blobs in unlinked sites #6279

Merged
merged 1 commit into from
Jan 2, 2024
Merged

Conversation

eduardoboucas
Copy link
Member

@eduardoboucas eduardoboucas commented Jan 2, 2024

Summary

We want to support Blobs in Netlify Dev even if the site is not linked — this was supposed to be addressed by #6176, but it didn't work properly (I've added more context in a comment). This PR fixes that.

Closes https://linear.app/netlify/issue/COM-211/blobs-possibly-not-working-in-framework-generated-functions.

@eduardoboucas eduardoboucas requested a review from a team as a code owner January 2, 2024 12:26
@@ -157,7 +157,7 @@ export const createHandler = function (options) {
'client-ip': [remoteAddress],
'x-nf-client-connection-ip': [remoteAddress],
'x-nf-account-id': [options.accountId],
'x-nf-site-id': [options?.siteInfo?.id] ?? 'unlinked',
Copy link
Member Author

Choose a reason for hiding this comment

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

This was the problem. [options?.siteInfo?.id] is never falsy, even when options?.siteInfo?.id is undefined, so the fallback string never kicked in.

Copy link

github-actions bot commented Jan 2, 2024

📊 Benchmark results

Comparing with 8c1084c

  • Dependency count: 1,399 (no change)
  • Package size: 405 MB ⬆️ 0.00% increase vs. 8c1084c
  • Number of ts-expect-error directives: 1,231 (no change)

@@ -28,7 +28,7 @@ const printLocalBlobsNotice = () => {
}

const startBlobsServer = async (debug: boolean, projectRoot: string, token: string) => {
const directory = path.resolve(projectRoot, getPathInProject(['blobs-serves']))
const directory = path.resolve(projectRoot, getPathInProject(['blobs-serve']))
Copy link
Member Author

Choose a reason for hiding this comment

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

Unrelated to the fix, but blobs-serves was a typo. It should be blobs-serve, in line with functions-serve and edge-functions-serve.

Copy link
Contributor

Choose a reason for hiding this comment

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

I forgot to mention this! I saw the directory and guessed it was a typo.

@eduardoboucas eduardoboucas merged commit d74c00d into main Jan 2, 2024
35 checks passed
@eduardoboucas eduardoboucas deleted the fix/blobs-unlinked branch January 2, 2024 14:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants