diff --git a/.changeset/many-shrimps-rush.md b/.changeset/many-shrimps-rush.md new file mode 100644 index 000000000000..e203e162d66d --- /dev/null +++ b/.changeset/many-shrimps-rush.md @@ -0,0 +1,5 @@ +--- +'@sveltejs/adapter-vercel': patch +--- + +fix: throw error if `isr` is combined with `runtime: 'edge'` diff --git a/packages/adapter-vercel/index.js b/packages/adapter-vercel/index.js index 0f02652f8e3d..1685513284c3 100644 --- a/packages/adapter-vercel/index.js +++ b/packages/adapter-vercel/index.js @@ -171,8 +171,18 @@ const plugin = function (defaults = {}) { const config = { runtime, ...defaults, ...route.config }; if (config.isr) { + const directory = path.relative('.', builder.config.kit.files.routes + route.id); + + if (runtime !== 'nodejs16.x' && runtime !== 'nodejs18.x') { + throw new Error( + `${directory}: Routes using \`isr\` must use either \`runtime: 'nodejs16.x'\` or \`runtime: 'nodejs18.x'\`` + ); + } + if (config.isr.allowQuery?.includes('__pathname')) { - throw new Error('__pathname is a reserved query parameter for isr.allowQuery'); + throw new Error( + `${directory}: \`__pathname\` is a reserved query parameter for \`isr.allowQuery\`` + ); } isr_config.set(route, {