sveltejs / sveltejs/kit

adapter-netlify edge function caching support

Open
#10,707 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

pkg:adapter-netlify
Dominant language
JavaScript
Stars
20.8k
Forks
2.3k
Avg merge
1d 16h
Merged PRs (30d)
156

Description

Describe the problem

One feature of Netlify edge functions is the ability to cache responses, described here: https://docs.netlify.com/edge-functions/optional-configuration/#response-caching

This requires a small change to the manifest to indicate manual caching control:

Opt in to caching
You can set the cache property to manual inline in the function code, or in netlify.toml.

For inline configuration, use the config object in your edge function file.

import type { Config } from "https://edge.netlify.com"

export default async () => new Response("Hello, world!")

export const config: Config = {
  cache: "manual",
  path: "/hello"
}
Describe the proposed solution

From what I understand, if the adapter allowed some level of configurability of the manifest output it would be possible to enable caching here:

https://github.com/sveltejs/kit/blob/c9a99b6c911c2ea9c919946aaada4f44293bdb75/packages/adapter-netlify/index.js#L116

Alternatives considered

No response

Importance

would make my life easier

Additional Information

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with packages/adapter-netlify/index.js around line 116 and compare its manifest output with Netlify's response-caching documentation. The issue is addressed when the adapter's generated manifest can express the requested caching configuration and remains compatible with the documented Netlify edge-function setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
build-system, cloud
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.