#Does deploying a new version of a tanstack start application break server actions?

14 messages · Page 1 of 1 (latest)

fallen elk
#

An unfortunate thing that I have experienced with server actions in Next.js is that when the user is browsing the website on the current version, then I push a new version to production, the server actions no longer work and I get errors in return. Using API routes in Next.js solves this problem, but I'm liking the DX of server actions.

Is this also a problem in TanStack Start, where server actions only work on the currently deployed version, and then they break when a new version is deployed while the user is browsing?

wind marlin
#

Yeah, I think the aim is to have support for skew protection down the line

exotic matrix
#

My plan is to support at the very least a very crude form of skew protection by sending back a build header with every response. If it doesn’t match, we’ll force a refresh

#

Probably make this configurable too so you could instead show a notification to users to refresh

#

But none of that is there yet

turbid zodiac
#

I'd be interested in implementing something like this given some guidance. Would it make sense to implement it myself first as a global middleware and then do a PR on Start. Assuming this isn't already in the works

toxic hamlet
#

Keeping the server function url stable doesn't help at all with that? The url should currently only change if you change the server functions name/variable or move it into another file from what I understand or you can provide a custom url generator that could even prevent url change in those scenarios

jaunty burrow
#

is there any way to not force a new version? we deploy a lot of times per day, most often any given server fn hasnt changed, id almost rather the once-in-a-while error than having to force a refresh all the time

limpid ermine
#

you should be able to tweak the serverFn id generator

turbid zodiac
#

So the stability works fine deploy to deploy until you change the serverfunction code I beleive, which makes sense you don't want to hit the same thing if it is different.
Even if you force it to be stable you need your front end to reload if your API is effectively changing.
So I think version detection that can force a frontend refresh is pretty valuable

toxic hamlet
#

Yea that's what I expected 👌 or you could also handle multiple versions within the same server function if that makes sense (and you force the url to be stable)

shrewd fern
#

Does orpc/trpc prevent this problem ?

heavy shuttle
shrewd fern
#

Not having latest version of s server function.