Skip to content

Fetch caching in Server actions #50045

Discussion options

You must be logged in to vote

I just encountered the same issue using Drizzle with the neon serverless connection. The caching docs do not go into detail into how to disable caching for Server Actions specifically but it seems using cookies() works.

export async function signIn(formData: FormData) {
  // disable cache for this server action
  const _cookies = cookies()

  // library calls using fetch
}

This 'magic' approach to caching at the cost of predictability really needs some work in my opinion.

Replies: 9 comments 11 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
7 replies
@hala94
Comment options

@RicFer01
Comment options

@arcataroger
Comment options

@ashish8796
Comment options

@aiaruu
Comment options

Answer selected by fuma-nama
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@Ankur-Datta-4
Comment options

@DuduzinCp
Comment options

@dfr-exnaton
Comment options

Comment options

You must be logged in to vote
1 reply
@Verron
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment