Skip to content

feat: split edge functions - #17045

Draft
teemingc wants to merge 38 commits into
version-3from
netlify-edge-split
Draft

feat: split edge functions#17045
teemingc wants to merge 38 commits into
version-3from
netlify-edge-split

Conversation

@teemingc

@teemingc teemingc commented Sep 7, 2026

Copy link
Copy Markdown
Member

This PR removes the arbitrary limitation where Netlify edge functions cannot be split.

Note: the Netlify split edge CI job won't run until it's in the main branch #17052


Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

Edits

  • Please ensure that 'Allow edits from maintainers' is checked. PRs without this option may be closed.

@pkg-svelte-dev

pkg-svelte-dev Bot commented Sep 7, 2026

Copy link
Copy Markdown

Install the latest version of @sveltejs/kit from 524d615:

pnpm add https://pkg.svelte.dev/@sveltejs/kit/c/524d615a24f1608958c6b7ddf07bae1b5bf9c633

Open in pkg.svelte.dev: https://pkg.svelte.dev/repos/kit/pr/17045

@changeset-bot

changeset-bot Bot commented Sep 7, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 524d615

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/adapter-netlify Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@teemingc teemingc added pkg:adapter-netlify needs-platform-tests This PR needs to run platform tests in order to merge. labels Sep 7, 2026
Comment thread packages/adapter-netlify/index.js Fixed
@teemingc teemingc mentioned this pull request Sep 7, 2026
6 tasks
…caping or encoding'

Co-authored-by: Copilot Autofix powered by AI <62310815+github-advanced-security[bot]@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Sep 7, 2026

Copy link
Copy Markdown

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: QUIET

Plan: Advanced

Run ID: fa8af2f6-da4b-41c9-9856-48059a83e120

📥 Commits

Reviewing files that changed from the base of the PR and between e62a880 and 3b9031c.

📒 Files selected for processing (1)
  • packages/adapter-netlify/index.js
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • sveltejs/vite-plugin-svelte (manual)
  • vitejs/vite (manual)
  • sveltejs/svelte (manual)

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The Netlify adapter now supports combined split and edge deployment. It shares split-route discovery across serverless and edge generation. Edge output now uses separate generated functions with Frameworks API configuration. The edge runtime accepts a supplied server through init. The deployment action and platform workflow pass and test the edge option. Documentation and release metadata now describe the combined configuration.

Merge Risk: 🟡 Moderate · up to 3b903

Split edge deployments with colliding optional-parameter route names can serve the wrong route handler because one generated function overwrites another. This should be resolved before merge.

🚥 Pre-merge checks | ✅ 2
✅ Passed checks (2 passed)
Check name Status Explanation
Backward Compatibility Impact Disclosure ✅ Passed No undocumented breaking public interface change is introduced. The package export map still exposes the same root entry point, and index.d.ts still exports the default adapter with optional edge
Title check ✅ Passed The title uses the required feat: prefix and accurately describes support for split Netlify Edge Functions.

Comment @coderabbitai help to get the list of available commands.

@svelte-docs-bot

Copy link
Copy Markdown

Comment thread packages/adapter-netlify/index.js Outdated
Comment thread packages/adapter-netlify/index.js Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 2

Note

Quiet mode is enabled, so only the most important comments were posted inline. Other review comments are grouped below.

🟡 Other comments (1)
.github/workflows/platform-tests-netlify.yml-146-149 (1)

146-149: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Gate the generated-file assertion for serverless builds.

The deploy step sets EDGE=true, so the adapter writes functions to .netlify/v1/edge-functions. The shared split generates multiple function files test reads .netlify/v1/functions and fails with ENOENT. Set EDGE: true on test-split-edge so the Playwright step can skip this serverless-only assertion. Keep the --functions=".netlify/v1/functions" option; Netlify CLI accepts a missing functions folder and still deploys edge functions.


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository YAML (base), Organization UI (inherited)

Review profile: QUIET

Plan: Advanced

Run ID: 50df0117-2774-4a0b-8849-575c9d026723

📥 Commits

Reviewing files that changed from the base of the PR and between 00f3037 and e62a880.

📒 Files selected for processing (11)
  • .changeset/petite-sites-enter.md
  • .github/actions/netlify-deploy/action.yml
  • .github/workflows/platform-tests-netlify.yml
  • documentation/docs/25-build-and-deploy/80-adapter-netlify.md
  • packages/adapter-netlify/files/edge.js
  • packages/adapter-netlify/files/serverless.js
  • packages/adapter-netlify/files/tsconfig.json
  • packages/adapter-netlify/index.d.ts
  • packages/adapter-netlify/index.js
  • packages/adapter-netlify/internal.d.ts
  • packages/adapter-netlify/test/apps/split/vite.config.ts
🔗 Linked repositories identified

CodeRabbit considers these linked repositories for cross-repo context during reviews:

  • sveltejs/vite-plugin-svelte (manual)
  • vitejs/vite (manual)
  • sveltejs/svelte (manual)
💤 Files with no reviewable changes (3)
  • packages/adapter-netlify/internal.d.ts
  • documentation/docs/25-build-and-deploy/80-adapter-netlify.md
  • packages/adapter-netlify/index.d.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Comment thread packages/adapter-netlify/index.js Outdated
Comment thread packages/adapter-netlify/index.js Outdated
@vercel-security-reviewer

Copy link
Copy Markdown

Security review details

@teemingc
teemingc marked this pull request as draft September 7, 2026 10:11
Comment thread packages/adapter-netlify/index.js
* @typedef {{
* build?: { publish?: string }
* functions?: { node_bundler?: 'zisi' | 'esbuild' }
* } & TomlTable} NetlifyConfig

@teemingc teemingc Sep 7, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't use this type anywhere so I removed it

read: async (file) => {
const url = `${origin}/${file}`;
const response = await fetch(url);
const initialized = server.init({

@teemingc teemingc Sep 7, 2026

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wrapped the logic of this file so that it's similar to the files/serverless.js one where we export a higher order function

Base automatically changed from netlify-split-uuid to version-3 September 7, 2026 16:15
else
echo "::error::Netlify deployment failed"
echo "$deploy_json" >&2
exit 1

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Helps error when deployment fails rather than silently passing

);
});

// always strip __pathname query parameter as it's reserved for split function reroutes

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need to manually verify this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs-platform-tests This PR needs to run platform tests in order to merge. pkg:adapter-netlify

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants