Skip to content

fetch override does not go well with Next.js' cachingย #917

@susemeee

Description

@susemeee

Bug report

  • I confirm this is a bug with Supabase, not with my own application.
  • I confirm I have searched the Docs, GitHub Discussions, and Discord.

Describe the bug

To assign cache tags to control Next.js' data caching, Supabase's custom fetch override should be used. Referred #725 (comment)

However there seems to be some incompatibility present; Next.js patched fetch API does not seem to be applied to Supabase's fetch, resulting data cache completely not to work.

To Reproduce

Steps to reproduce the behavior, please provide code snippets or a repository:

There is a sample project for reproduction.

  1. Build and deploy sample project
    • A supabase project and deployment target should've set up; I used CloudFlare
  2. Data caching and API such as revalidateTag from Next.js does not work properly, compared to direct usage of fetch API in the test code

Expected behavior

Whether fetch is used directly or via Supabase API the data cache should be used.

Screenshots

If applicable, add screenshots to help explain your problem.

System information

  • Version of supabase-js: 2.38.4
  • Version of Node.js: v20.2.0
  • Version of Next.js: v13.5.4

Additional context

Add any other context about the problem here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions