-
Notifications
You must be signed in to change notification settings - Fork 87
feat: use Frameworks API #2547
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
Draft
pieh
wants to merge
21
commits into
main
Choose a base branch
from
michalpiechowiak/frp-765-migrate-next-runtime-to-use-frameworks-api
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
feat: use Frameworks API #2547
Changes from 11 commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
2729455
migrate blobs to frameworks api
pieh 5a5fcb0
migrate serverless functions to frameworks api
pieh dda77b7
migrate edge functions to frameworks api
pieh 173cefe
prep blobs handling to conditionally use frameworks api, but still be…
pieh 96edce2
conditionally use frameworski api when generating serverless and edge…
pieh c9f0f41
memoize deployment config
pieh 0c91ea6
try integration tests with recent build version
pieh 869e448
integration tests handle frameworks api
pieh 3f27a9a
test: add e2e test for pre-frameworks api
pieh 9864c7c
don't introduce eslint disables
pieh 1d49fff
test: add unit test for frameworks API dirs
pieh 4817063
chore: update some code comments
pieh aec7ac2
fix lint
pieh f3b7306
add a helper for how edge function config is defined
pieh ab76a7d
Merge remote-tracking branch 'origin/main' into michalpiechowiak/frp-…
pieh 7630ab4
add a helper for how serverless function config is defined
pieh 6c7874c
Merge remote-tracking branch 'origin/main' into michalpiechowiak/frp-…
pieh 4358a1c
Merge remote-tracking branch 'origin/main' into michalpiechowiak/frp-…
pieh ee47e8b
add next.deployStrategy otel attribute
pieh e3a806c
update new test assertion
pieh 4424419
validate deployment setup to ensure we are testing what we think we a…
pieh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,28 @@ | ||
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 frameworks API', async ({ | ||
page, | ||
cliBeforeFrameworksAPISupport, | ||
}) => { | ||
// 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. | ||
// This also tests if edge middleware is working. | ||
|
||
const response = await page.goto(new URL('non-existing', cliBeforeFrameworksAPISupport.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') | ||
|
||
expect(headers['x-hello-from-middleware']).toBe('hello') | ||
}) |
9 changes: 9 additions & 0 deletions
9
tests/fixtures/cli-before-frameworks-api-support/middleware.ts
This file contains hidden or 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,9 @@ | ||
import { NextResponse } from 'next/server' | ||
|
||
export function middleware() { | ||
const response: NextResponse = NextResponse.next() | ||
|
||
response.headers.set('x-hello-from-middleware', 'hello') | ||
|
||
return response | ||
} |
8 changes: 8 additions & 0 deletions
8
tests/fixtures/cli-before-frameworks-api-support/next.config.js
This file contains hidden or 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,8 @@ | ||
/** @type {import('next').NextConfig} */ | ||
const nextConfig = { | ||
eslint: { | ||
ignoreDuringBuilds: true, | ||
}, | ||
} | ||
|
||
module.exports = nextConfig |
16 changes: 16 additions & 0 deletions
16
tests/fixtures/cli-before-frameworks-api-support/package.json
This file contains hidden or 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,16 @@ | ||
{ | ||
"name": "old-cli", | ||
"version": "0.1.0", | ||
"private": true, | ||
"scripts": { | ||
"postinstall": "next build", | ||
"dev": "next dev", | ||
"build": "next build" | ||
}, | ||
"dependencies": { | ||
"next": "latest", | ||
"netlify-cli": "17.32.0", | ||
"react": "^18.2.0", | ||
"react-dom": "^18.2.0" | ||
} | ||
} |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.