-
Notifications
You must be signed in to change notification settings - Fork 87
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Update to latest blob client (7.3.0) (#398)
* chore: Add buildVersion and useRegionalBlobs to PluginContext * chore: Centralize deploy store configuration * chore: Extract FixtureTestContext and BLOB_TOKEN into their own files * chore: Prepare getBlobServerGets to handle regions * chore: Set and make use of shared build/run USE_REGIONAL_BLOBS environment variable * chore: Use latest @netlify/blobs version * chore: Pin regional blob functionality to a higher version of the cli * chore: mark all runtime modules as external * fix: Ensure ts files are compiled in unit tests * chore: linting * maybe win slash? * test: add fixture using CLI before regional blobs support * test: use createRequestContext in tests instead of manually creating request context objects * Update tests/e2e/page-router.test.ts Co-authored-by: Philippe Serhal <[email protected]> * test: rename unit test for blobs directory --------- Co-authored-by: Michal Piechowiak <[email protected]> Co-authored-by: Philippe Serhal <[email protected]>
- Loading branch information
1 parent
27ab1f3
commit 8b3f65b
Showing
39 changed files
with
293 additions
and
161 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { getDeployStore, Store } from '@netlify/blobs' | ||
|
||
const fetchBeforeNextPatchedIt = globalThis.fetch | ||
|
||
export const getRegionalBlobStore = (args: Parameters<typeof getDeployStore>[0] = {}): Store => { | ||
return getDeployStore({ | ||
...args, | ||
fetch: fetchBeforeNextPatchedIt, | ||
experimentalRegion: | ||
process.env.USE_REGIONAL_BLOBS?.toUpperCase() === 'TRUE' ? 'context' : undefined, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { expect } from '@playwright/test' | ||
import { test } from '../utils/playwright-helpers.js' | ||
|
||
test('should serve 404 page when requesting non existing page (no matching route) if site is deployed with CLI not supporting regional blobs', async ({ | ||
page, | ||
cliBeforeRegionalBlobsSupport, | ||
}) => { | ||
// 404 page is built and uploaded to blobs at build time | ||
// when Next.js serves 404 it will try to fetch it from the blob store | ||
// if request handler function is unable to get from blob store it will | ||
// fail request handling and serve 500 error. | ||
// This implicitly tests that request handler function is able to read blobs | ||
// that are uploaded as part of site deploy. | ||
|
||
const response = await page.goto(new URL('non-existing', cliBeforeRegionalBlobsSupport.url).href) | ||
const headers = response?.headers() || {} | ||
expect(response?.status()).toBe(404) | ||
|
||
expect(await page.textContent('h1')).toBe('404') | ||
|
||
expect(headers['netlify-cdn-cache-control']).toBe( | ||
'no-cache, no-store, max-age=0, must-revalidate', | ||
) | ||
expect(headers['cache-control']).toBe('no-cache,no-store,max-age=0,must-revalidate') | ||
}) |
Oops, something went wrong.