TanStackT
TanStack14mo ago
6 replies
brilliant-lime

Returning response object no longer works.

I upgraded to 1.82.1 and i have a serverFn that looks like this with the new syntax:

export const fetchPdf = createServerFn({ method: 'GET' })
    .validator((data: { url: string }) => data)
    .handler(async ({ data: { url } }) => {
        return fetch(url)
    })

previously this used to fetch the url, but now it does not, and inferred types from calling the function is
any

Is there a new way to do this returning response object?
Was this page helpful?