Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion packages/runtime/src/helpers/functionsMetaData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const getNextRuntimeVersion = async (packageJsonPath: string, useNodeModulesPath

const PLUGIN_PACKAGE_PATH = '.netlify/plugins/package.json'

const nextPluginVersion = async (module?: string) => {
export const nextPluginVersion = async (module?: string) => {
const moduleRoot = resolveModuleRoot(module || NEXT_PLUGIN)
const nodeModulesPath = moduleRoot ? join(moduleRoot, 'package.json') : null

Expand Down
8 changes: 8 additions & 0 deletions packages/runtime/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { bold, redBright } from 'chalk'
import destr from 'destr'
import { existsSync, readFileSync } from 'fs-extra'
import { outdent } from 'outdent'
import { satisfies } from 'semver'

import { HANDLER_FUNCTION_NAME, ODB_FUNCTION_NAME } from './constants'
import { restoreCache, saveCache } from './helpers/cache'
Expand All @@ -30,6 +31,7 @@ import {
APILambda,
getSSRLambdas,
} from './helpers/functions'
import { nextPluginVersion } from './helpers/functionsMetaData'
import { generateRedirects, generateStaticRedirects } from './helpers/redirects'
import {
shouldSkip,
Expand Down Expand Up @@ -79,6 +81,12 @@ const plugin: NetlifyPlugin = {
checkForRootPublish({ publish, failBuild })
verifyNetlifyBuildVersion({ failBuild, ...constants })

const nextVersion = await nextPluginVersion('next')
if (!satisfies(nextVersion, '< 13.5')) {
failBuild('NextJS 13.5 and newer is not yet supported.')
return
}

await restoreCache({ cache, publish })

netlifyConfig.build.environment ||= {}
Expand Down