Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: opennextjs/opennextjs-netlify
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v5.3.1
Choose a base ref
...
head repository: opennextjs/opennextjs-netlify
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v5.3.2
Choose a head ref

Commits on May 23, 2024

  1. Copy the full SHA
    779515b View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d4df6a5 View commit details
  3. chore(deps): update dependency @netlify/build to ^29.42.2 (#526)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored May 23, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    d7b8e0a View commit details
  4. Copy the full SHA
    9b243ba View commit details

Commits on May 24, 2024

  1. Copy the full SHA
    89de325 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    b2ac7fc View commit details
  3. fix: allow parallel routes to resolve without routing to a 404 page (#…

    …516)
    
    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
    mrstork and kodiakhq[bot] authored May 24, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    04dc3ec View commit details
  4. Skip flaky parallel routes e2e test (#524)

    * chore: sort list alphabetically
    
    * test: skip flaky parallel route test, specify reason
    
    ---------
    
    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
    mrstork and kodiakhq[bot] authored May 24, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    5d7253b View commit details
  5. Copy the full SHA
    4d681e1 View commit details
  6. chore: use branch test results for e2e page (#517)

    * added input
    
    * add if to stop deplot if not run ID
    
    * changes input type to boolean
    
    * remove string
    
    * revert
    
    ---------
    
    Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
    taty2010 and kodiakhq[bot] authored May 24, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    298f5a7 View commit details
  7. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    388cac3 View commit details

Commits on May 27, 2024

  1. Copy the full SHA
    56a635a View commit details
  2. Copy the full SHA
    ca0c368 View commit details
  3. fix: ensure locale is in next response url to allow page locale to in…

    …ferred downstream (#533)
    
    * fix: ensure locale is in next request to allow page locale to be calculated downstream
    
    * test: Add checks for nextRequest locale
    mrstork authored May 27, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    59b575e View commit details
  4. Copy the full SHA
    ef1613a View commit details
  5. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    6b78df0 View commit details
  6. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    6c609fc View commit details
  7. Copy the full SHA
    12af519 View commit details

Commits on May 28, 2024

  1. fix: manually triggered notFound pages in page-router for older versi…

    …ons of next (#541)
    
    * test: update simple-app fixture to have clearer route and to use custom 404
    
    * fix: improve parallel route matching when building server cache
    
    ---------
    
    Co-authored-by: Michal Piechowiak <misiek.piechowiak@gmail.com>
    mrstork and pieh authored May 28, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    30ef981 View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    b435ea6 View commit details
  3. Copy the full SHA
    bac1848 View commit details
  4. test: fixture and tests updates for next@canary (#540)

    * test: explicitly mark test route handler as cacheable
    
    * test: explicitly mark test route handler as non cacheable
    pieh authored May 28, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    87342c3 View commit details
  5. chore(main): release 5.3.2 (#542)

    Co-authored-by: token-generator-app[bot] <82042599+token-generator-app[bot]@users.noreply.github.com>
    Co-authored-by: Mateusz Bocian <mrstork@users.noreply.github.com>
    token-generator-app[bot] and mrstork authored May 28, 2024

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    Copy the full SHA
    f309416 View commit details
11 changes: 10 additions & 1 deletion .github/workflows/e2e-report.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
name: 'Deploy e2e test page'
on:
workflow_dispatch:
inputs:
use-branch:
description: 'Enable if you want to test data from your selected branch instead of the scheduled test runs from Main'
type: boolean

env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_TOKEN }}
@@ -15,9 +19,14 @@ jobs:
- name: Get run id
id: get-run-id
run: |
E2E_RUN_ID=$(gh run list -w test-e2e.yml -e schedule --json databaseId --jq ".[0].databaseId" --repo $GITHUB_REPOSITORY)
if [ "${{ inputs.use-branch }}" == "true" ]; then
E2E_RUN_ID=$(gh run list -w test-e2e.yml -e workflow_dispatch -b $GITHUB_REF_NAME --json databaseId --jq ".[0].databaseId" --repo $GITHUB_REPOSITORY)
else
E2E_RUN_ID=$(gh run list -w test-e2e.yml -e schedule --json databaseId --jq ".[0].databaseId" --repo $GITHUB_REPOSITORY)
fi
echo "runId=$E2E_RUN_ID" >> $GITHUB_OUTPUT
- name: Download latest e2e results
if: ${{ steps.get-run-id.outputs.runId }}
run: |
echo "Downloading latest test results from run https://github.com/netlify/next-runtime-minimal/actions/runs/${{ steps.get-run-id.outputs.runId }}"
rm e2e-report/data/test-results.json
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ jobs:
with:
private-key: ${{ secrets.TOKENS_PRIVATE_KEY }}
app-id: ${{ secrets.TOKENS_APP_ID }}
- uses: google-github-actions/release-please-action@v4
- uses: googleapis/release-please-action@v4
id: release
with:
token: ${{ steps.get-token.outputs.token }}
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "5.3.1"
".": "5.3.2"
}
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog

## [5.3.2](https://github.com/netlify/next-runtime-minimal/compare/v5.3.1...v5.3.2) (2024-05-28)


### Bug Fixes

* allow parallel routes to resolve without routing to a 404 page ([#516](https://github.com/netlify/next-runtime-minimal/issues/516)) ([04dc3ec](https://github.com/netlify/next-runtime-minimal/commit/04dc3ecb4c6723e235f42e0ae305229497bdac03))
* ensure locale is in next response url to allow page locale to inferred downstream ([#533](https://github.com/netlify/next-runtime-minimal/issues/533)) ([59b575e](https://github.com/netlify/next-runtime-minimal/commit/59b575e5ce3db1aac6777648ede245f5358de070))
* manually triggered notFound pages in page-router for older versions of next ([#541](https://github.com/netlify/next-runtime-minimal/issues/541)) ([30ef981](https://github.com/netlify/next-runtime-minimal/commit/30ef98119d5d8a7deb48c90454e0983526246f18))

## [5.3.1](https://github.com/netlify/next-runtime-minimal/compare/v5.3.0...v5.3.1) (2024-05-22)


4 changes: 2 additions & 2 deletions e2e-report/app/page.js
Original file line number Diff line number Diff line change
@@ -7,13 +7,13 @@ export default function Home() {
const { results, passed, failed, total, passRate, skipped, testDate, nextVersion } = testData
const skippedTests = []
results.forEach((suite) => {
if (suite.skipped) {
if (suite.skipped === true) {
skippedTests.push(suite)
}

const { testCases } = suite
testCases?.forEach((testCase) => {
if (testCase.link) {
if (testCase.status === 'failed') {
skippedTests.push(testCase)
}
})
8 changes: 4 additions & 4 deletions e2e-report/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion e2e-report/package.json
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@
"lint": "next lint"
},
"dependencies": {
"@netlify/plugin-nextjs": "^5.3.0",
"@netlify/plugin-nextjs": "^5.3.1",
"chart.js": "^4.4.2",
"next": "^14.2.3",
"react": "^18.3.1",
9 changes: 7 additions & 2 deletions edge-runtime/lib/next-request.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import type { Context } from '@netlify/edge-functions'

import { normalizeDataUrl, removeBasePath, normalizeLocalePath, addBasePath } from './util.ts'
import { addBasePath, normalizeDataUrl, normalizeLocalePath, removeBasePath } from './util.ts'

interface I18NConfig {
defaultLocale: string
@@ -74,6 +74,11 @@ const normalizeRequestURL = (
url.pathname = addBasePath(url.pathname, nextConfig?.basePath)
}

// keep the locale in the url for request.nextUrl object
if (detectedLocale) {
url.pathname = `/${detectedLocale}${url.pathname}`
}

return {
url: url.toString(),
detectedLocale,
@@ -88,9 +93,9 @@ export const buildNextRequest = (
const { url, method, body, headers } = request
const { country, subdivision, city, latitude, longitude, timezone } = context.geo
const geo: RequestData['geo'] = {
city,
country: country?.code,
region: subdivision?.code,
city,
latitude: latitude?.toString(),
longitude: longitude?.toString(),
timezone,
2 changes: 0 additions & 2 deletions edge-runtime/lib/util.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import type { RequestData } from './next-request.ts'

/**
* Normalize a data URL into a route path.
* @see https://github.com/vercel/next.js/blob/25e0988e7c9033cb1503cbe0c62ba5de2e97849c/packages/next/src/shared/lib/router/utils/get-next-pathname-info.ts#L69-L76
5 changes: 2 additions & 3 deletions edge-runtime/middleware.ts
Original file line number Diff line number Diff line change
@@ -6,12 +6,11 @@ import nextConfig from './next.config.json' assert { type: 'json' }
import { InternalHeaders } from './lib/headers.ts'
import { logger, LogLevel } from './lib/logging.ts'
import { buildNextRequest, RequestData } from './lib/next-request.ts'
import { buildResponse } from './lib/response.ts'
import { FetchEventResult } from './lib/response.ts'
import { buildResponse, FetchEventResult } from './lib/response.ts'
import {
type MiddlewareRouteMatch,
getMiddlewareRouteMatcher,
searchParamsToUrlQuery,
type MiddlewareRouteMatch,
} from './lib/routing.ts'

type NextHandler = (params: { request: RequestData }) => Promise<FetchEventResult>
1,223 changes: 856 additions & 367 deletions package-lock.json

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@netlify/plugin-nextjs",
"version": "5.3.1",
"version": "5.3.2",
"description": "Run Next.js seamlessly on Netlify",
"main": "./dist/index.js",
"type": "module",
@@ -50,13 +50,13 @@
"devDependencies": {
"@fastly/http-compute-js": "1.1.4",
"@netlify/blobs": "^7.3.0",
"@netlify/build": "^29.42.1",
"@netlify/build": "^29.43.0",
"@netlify/edge-bundler": "^12.0.1",
"@netlify/edge-functions": "^2.8.1",
"@netlify/eslint-config-node": "^7.0.1",
"@netlify/functions": "^2.7.0",
"@netlify/serverless-functions-api": "^1.18.1",
"@netlify/zip-it-and-ship-it": "^9.33.0",
"@netlify/serverless-functions-api": "^1.18.2",
"@netlify/zip-it-and-ship-it": "^9.33.2",
"@opentelemetry/api": "^1.8.0",
"@opentelemetry/exporter-trace-otlp-http": "^0.51.0",
"@opentelemetry/resources": "^1.24.0",
11 changes: 5 additions & 6 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
{
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json",
"exclude-paths": ["e2e-report", "tests", "tools", "turbofan"],
"include-component-in-tag": false,
"packages": {
".": {
"exclude-paths": ["e2e-report", "tests", "tools", "turbofan"],
"include-component-in-tag": false
}
},
"plugins": ["node-workspace"]
".": {}
}
}
8 changes: 7 additions & 1 deletion src/build/content/prerendered.ts
Original file line number Diff line number Diff line change
@@ -57,7 +57,13 @@ const buildAppCacheValue = async (path: string): Promise<CachedPageValue> => {
readFile(`${path}.prefetch.rsc`, 'utf-8'),
)

if (!meta.status && rsc.includes('NEXT_NOT_FOUND')) {
// Next < v14.2.0 does not set meta.status when notFound() is called directly on a page
// Exclude Parallel routes, they are 404s when visited directly
if (
!meta.status &&
rsc.includes('NEXT_NOT_FOUND') &&
!meta.headers['x-next-cache-tags'].includes('/@')
) {
meta.status = 404
}

2 changes: 2 additions & 0 deletions tests/e2e-skip-retry.json
Original file line number Diff line number Diff line change
@@ -92,6 +92,7 @@
"test/e2e/app-dir/mjs-as-extension/mjs-as-extension.test.ts",
"test/e2e/app-dir/modularizeimports/modularizeimports.test.ts",
"test/e2e/app-dir/navigation/navigation.test.ts",
"test/e2e/app-dir/next-after-app/index.test.ts",
"test/e2e/app-dir/next-config/index.test.ts",
"test/e2e/app-dir/next-font/next-font.test.ts",
"test/e2e/app-dir/next-image/next-image-https.test.ts",
@@ -233,6 +234,7 @@
"test/e2e/prerender-native-module.test.ts",
"test/e2e/prerender.test.ts",
"test/e2e/proxy-request-with-middleware/test/index.test.ts",
"test/e2e/react-compiler/react-compiler.test.ts",
"test/e2e/react-dnd-compile/react-dnd-compile.test.ts",
"test/e2e/reload-scroll-backforward-restoration/index.test.ts",
"test/e2e/repeated-forward-slashes-error/repeated-forward-slashes-error.test.ts",
6 changes: 3 additions & 3 deletions tests/e2e/simple-app.test.ts
Original file line number Diff line number Diff line change
@@ -213,7 +213,7 @@ test('requesting a non existing page route that needs to be fetched from the blo
const headers = response?.headers() || {}
expect(response?.status()).toBe(404)

expect(await page.textContent('h1')).toBe('404')
expect(await page.textContent('h1')).toBe('404 Not Found')

expect(headers['netlify-cdn-cache-control']).toBe(
'private, no-cache, no-store, max-age=0, must-revalidate',
@@ -225,11 +225,11 @@ test('requesting a non existing page route that needs to be fetched from the blo
page,
simple,
}) => {
const response = await page.goto(new URL('not-found', simple.url).href)
const response = await page.goto(new URL('route-resolves-to-not-found', simple.url).href)
const headers = response?.headers() || {}
expect(response?.status()).toBe(404)

expect(await page.textContent('h1')).toBe('404')
expect(await page.textContent('h1')).toBe('404 Not Found')

expect(headers['netlify-cdn-cache-control']).toBe(
's-maxage=31536000, stale-while-revalidate=31536000',
4 changes: 4 additions & 0 deletions tests/fixtures/middleware-i18n/middleware.js
Original file line number Diff line number Diff line change
@@ -80,4 +80,8 @@ export async function middleware(request) {
console.log(String(new URL('/new-home#fragment', url)))
return Response.redirect(new URL('/new-home#fragment', url))
}

if (url.pathname.includes('/json')) {
return NextResponse.json({ url: request.nextUrl.href, locale: request.nextUrl.locale })
}
}
Original file line number Diff line number Diff line change
@@ -8,3 +8,5 @@ export async function GET() {

return NextResponse.json({ data, time: new Date().toISOString() })
}

export const dynamic = 'force-static'
8 changes: 8 additions & 0 deletions tests/fixtures/simple/app/not-found.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
export default function NotFound() {
return (
<div>
<h1>404 Not Found</h1>
<p>Custom Not Found Page</p>
</div>
)
}
2 changes: 2 additions & 0 deletions tests/fixtures/simple/app/redirect/response/route.js
Original file line number Diff line number Diff line change
@@ -3,3 +3,5 @@ import { NextRequest, NextResponse } from 'next/server'
export async function GET() {
return NextResponse.redirect('https://www.netlify.com/')
}

export const dynamic = 'force-dynamic'
2 changes: 2 additions & 0 deletions tests/fixtures/simple/app/redirect/route.js
Original file line number Diff line number Diff line change
@@ -3,3 +3,5 @@ import { redirect } from 'next/navigation'
export async function GET() {
return redirect('https://www.netlify.com/')
}

export const dynamic = 'force-dynamic'
File renamed without changes.
2 changes: 1 addition & 1 deletion tests/integration/cache-handler.test.ts
Original file line number Diff line number Diff line change
@@ -326,7 +326,7 @@ describe('plugin', () => {
})

describe('route', () => {
test<FixtureTestContext>('route handler with revalidate', async (ctx) => {
test<FixtureTestContext>('route handler with cacheable response', async (ctx) => {
await createFixture('server-components', ctx)
await runPlugin(ctx)

26 changes: 26 additions & 0 deletions tests/integration/edge-handler.test.ts
Original file line number Diff line number Diff line change
@@ -499,4 +499,30 @@ describe('page router', () => {
expect(url.pathname).toBe('/fr/new-home')
expect(response.status).toBe(302)
})

test<FixtureTestContext>('should preserve locale in request.nextUrl', async (ctx) => {
await createFixture('middleware-i18n', ctx)
await runPlugin(ctx)
const origin = await LocalServer.run(async (req, res) => {
res.write(
JSON.stringify({
url: req.url,
headers: req.headers,
}),
)
res.end()
})
ctx.cleanup?.push(() => origin.stop())
const response = await invokeEdgeFunction(ctx, {
functions: ['___netlify-edge-handler-middleware'],
origin,
url: `/fr/json`,
})
expect(response.status).toBe(200)

const body = await response.json()
const bodyUrl = new URL(body.url)
expect(bodyUrl.pathname).toBe('/fr/json')
expect(body.locale).toBe('fr')
})
})
8 changes: 3 additions & 5 deletions tests/integration/simple-app.test.ts
Original file line number Diff line number Diff line change
@@ -65,10 +65,8 @@ test<FixtureTestContext>('Test that the simple next app is working', async (ctx)
'/image/remote-pattern-1',
'/image/remote-pattern-2',
'/index',
'/not-found',
'/other',
'/redirect',
'/redirect/response',
'/route-resolves-to-not-found',
'404.html',
'500.html',
])
@@ -82,13 +80,13 @@ test<FixtureTestContext>('Test that the simple next app is working', async (ctx)
expect(other.statusCode).toBe(200)
expect(load(other.body)('h1').text()).toBe('Other')

const notFound = await invokeFunction(ctx, { url: 'not-found' })
const notFound = await invokeFunction(ctx, { url: 'route-resolves-to-not-found' })
expect(notFound.statusCode).toBe(404)
expect(notFound.body).toContain('NEXT_NOT_FOUND')

const notExisting = await invokeFunction(ctx, { url: 'non-exisitng' })
expect(notExisting.statusCode).toBe(404)
expect(load(notExisting.body)('h1').text()).toBe('404')
expect(load(notExisting.body)('h1').text()).toBe('404 Not Found')
})

describe('verification', () => {
30 changes: 29 additions & 1 deletion tests/test-config.json
Original file line number Diff line number Diff line change
@@ -130,7 +130,8 @@
"file": "test/e2e/app-dir/parallel-routes-and-interception/parallel-routes-and-interception.test.ts",
"reason": "Tries to patch deployed files",
"tests": [
"parallel-routes-and-interception parallel routes should gracefully handle when two page segments match the `children` parallel slot"
"parallel-routes-and-interception parallel routes should gracefully handle when two page segments match the `children` parallel slot",
"parallel-routes-and-interception with patching should gracefully handle when two page segments match the `children` parallel slot"
]
},
{
@@ -173,6 +174,7 @@
"reason": "Header whitespace mismatch",
"tests": [
"app dir - metadata dynamic routes robots.txt should handle robots.[ext] dynamic routes",
"app dir - metadata dynamic routes sitemap should handle sitemap.[ext] dynamic routes",
"app dir - metadata dynamic routes robots.txt should handle sitemap.[ext] dynamic routes",
"app dir - metadata dynamic routes social image routes should handle manifest.[ext] dynamic routes",
"app dir - metadata dynamic routes social image routes should render og image with opengraph-image dynamic routes",
@@ -314,6 +316,27 @@
"reason": "Error in test"
}
]
},
{
"file": "test/e2e/app-dir/next-after-app/index.test.ts",
"reason": "Tries to patch deployed files"
},
{
"file": "test/e2e/react-compiler/react-compiler.test.ts",
"tests": [
"react-compiler default should show an experimental warning",
"react-compiler babelrc should show an experimental warning"
],
"reason": "Uses CLI output"
},
{
"file": "test/e2e/edge-async-local-storage/index.test.ts",
"reason": "Test is incompatible with serverless because it relies on shared state between requests"
},
{
"file": "test/e2e/app-dir/parallel-routes-revalidation/parallel-routes-revalidation.test.ts",
"reason": "Test is incompatible with serverless because it relies on shared state between requests",
"tests": ["should refresh the correct page when a server action triggers a redirect"]
}
],
"failures": [
@@ -337,6 +360,11 @@
"reason": "Nonce not automatically set in script tags when using CSP",
"link": "https://github.com/netlify/next-runtime-minimal/issues/381"
},
{
"name": "app dir - basic next/script should pass nonce when using next/font",
"reason": "Nonce not automatically set in script tags when using CSP",
"link": "https://github.com/netlify/next-runtime-minimal/issues/381"
},
{
"name": "Middleware Runtime with i18n should validate & parse request url from a dynamic route with params",
"reason": "Middleware in sites with i18n generating incorrect request.url pathname",