T
TanStack2w ago
secure-lavender

RC causing Cloudflare 499 errors with UplaodThing

Hi guys, I originally posted in Theo's discord about UT throwing 499 errors now - TL;DR I managed to track down that it was the RC for TAnstack Start that was causing the issue. Using this minimal UT example I wasn't getting the error but then I updated the deps of Router and Start to the latest and I started getting the 499 error: https://github.com/pingdotgg/uploadthing/tree/main/examples/minimal-tanstack-start Changes I made for the example to work post update: router.tsx changed to:
import { createRouter } from "@tanstack/react-router";
import { routeTree } from "./routeTree.gen";

export function getRouter() {
const router = createRouter({
routeTree,
scrollRestoration: true,
defaultPreload: "intent",
})

return router
}
import { createRouter } from "@tanstack/react-router";
import { routeTree } from "./routeTree.gen";

export function getRouter() {
const router = createRouter({
routeTree,
scrollRestoration: true,
defaultPreload: "intent",
})

return router
}
api.uploadthing.ts updated to:
import { createRouteHandler } from "uploadthing/server";

import { uploadRouter } from "../server/uploadthing";
import { createFileRoute } from "@tanstack/react-router"

const utHandler = createRouteHandler({ router: uploadRouter });

export const Route = createFileRoute("/api/uploadthing")({
server: {
handlers: {
GET({request}) { return utHandler(request) },
POST({request}) { return utHandler(request) },
},
}
});
import { createRouteHandler } from "uploadthing/server";

import { uploadRouter } from "../server/uploadthing";
import { createFileRoute } from "@tanstack/react-router"

const utHandler = createRouteHandler({ router: uploadRouter });

export const Route = createFileRoute("/api/uploadthing")({
server: {
handlers: {
GET({request}) { return utHandler(request) },
POST({request}) { return utHandler(request) },
},
}
});
This is the minimal repro I could come up with. I know the error is being thrown by UT but since it was the upgrade of the TS packages that causes the error I figured this is where we'd find the fix for it. Anyone got any ideas?
GitHub
uploadthing/examples/minimal-tanstack-start at main · pingdotgg/up...
File uploads for modern web devs. Contribute to pingdotgg/uploadthing development by creating an account on GitHub.
5 Replies
wise-white
wise-white2w ago
how can this be run locally?
secure-lavender
secure-lavenderOP2w ago
I cloned the repo, cd in to the example folder, npm i and run dev. Happy to run any experiments my end if you have any immediate ideas and are bottlenecked for time @Manuel Schiller.
wise-white
wise-white2w ago
where does the 499 originate? what's the internal reason for that?
secure-lavender
secure-lavenderOP2w ago
Cloudflare throws 499 when the client closes the connection - this is happening in UploadThing but seems to be caused by the Start RC since it works fine on the older version. I raised it over there, here's my original message from there: https://discord.com/channels/966627436387266600/1102510616326967306/1426223365609357383 I feel this may require some back and forth with the ping guys.
wise-white
wise-white2w ago
who is the client here? the browser or the server? is this happening during SSR? can you please provide a repo that includes all your changes?

Did you find this page helpful?