Skip to content

Passing { next: { revalidate, tags } } options to ky does not work in NextJS edge (at least with dev server) #541

Open
@dkokotov

Description

@dkokotov

The fix for passing unknown options to fetch (#536) does not work correctly for the next options used by Next.js to control cache revalidation, when using edge runtime on dev server.

I think this is because the ky implementation relies on passing only keys that are not in Request in the second argument of fetch. however, it looks like Next.js patches Request to also have a next key (I think this may be the culprit, though not totally sure: https://github.com/vercel/next.js/blob/canary/packages/next/src/server/web/sandbox/context.ts#L370), so this results in next key not being included.

I verified it with a wrapper fetch function that logs the second input (similar to how the test in the PR above is written). I can see that keys other than next are correctly passed, and in the node runtime the next key is passed, but in the edge runtime it is not.

I have not yet tested if this problem is present in the production edge environment, or only dev server.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions