You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have noticed a random 404 error when fetching from itself, i.e. /api/uploadthing fetches /api/uploadthing on the same server. We use this for our dev webhook but it seems to fails for some reason...
To reproduce, checkout the repo and the linked branch, pnpm i, pnpm build, cd examples/backend-adapters and run the h3 example using pnpm dev:h3. This starts a vite server up at port 5173 as well as a listhen instance on port 3000 with the h3 app.
Attempt to upload an image, and wait for the 404 to show up.
I also added a simple nitro server that you can compare to (run using pnpm dev:nitro), which works out of the box without issues. Maybe I have configured the h3 app wrong?
Additional context
I also tried using a "raw" node.js server to eliminate listhen as the possible cause of error but that had the same behavior
Running the h3 app
CleanShot.2024-01-23.at.17.02.38.mp4
Running Nitro for comparison
CleanShot.2024-01-23.at.17.04.23.mp4
Logs
No response
The text was updated successfully, but these errors were encountered:
H3 router by default is in non-preemptive mode (see #194 and #183 -- it is to allow multiple routers) but in Nitro, the router is preemptive because we can safely assume it for top-level router (nitrojs/nitro#1504). When router is in non-preemptive mode and an event handler returns an undefined value (the issue in uploadthing), h3 keep search other middleware (which non of them also response) and finally give a 404 back.
Also I think if you like, we might introduce an UnStorage provider for upload thing! I think it would make usage much more ergonomic for Nitro/Nuxt users! ~> unjs/unstorage#389
Environment
Reproduction
https://github.com/pingdotgg/uploadthing/tree/h3-debug
https://github.com/pingdotgg/uploadthing/blob/h3-debug/examples/backend-adapters/server/src/h3.ts
Describe the bug
I have noticed a random 404 error when fetching from itself, i.e.
/api/uploadthing
fetches/api/uploadthing
on the same server. We use this for our dev webhook but it seems to fails for some reason...To reproduce, checkout the repo and the linked branch,
pnpm i
,pnpm build
,cd examples/backend-adapters
and run the h3 example usingpnpm dev:h3
. This starts a vite server up at port 5173 as well as a listhen instance on port 3000 with the h3 app.Attempt to upload an image, and wait for the 404 to show up.
I also added a simple nitro server that you can compare to (run using
pnpm dev:nitro
), which works out of the box without issues. Maybe I have configured the h3 app wrong?Additional context
I also tried using a "raw" node.js server to eliminate listhen as the possible cause of error but that had the same behavior
Running the h3 app
CleanShot.2024-01-23.at.17.02.38.mp4
Running Nitro for comparison
CleanShot.2024-01-23.at.17.04.23.mp4
Logs
No response
The text was updated successfully, but these errors were encountered: