Closed KirioXX closed 3 months ago
Hi, might have to do that you are using Uppy in React incorrectly. Uppy can't be declared as a simple variable inside your component. Checkout the docs: https://uppy.io/docs/react/.
Hi @Murderlon, thanks for the quick response.
I tried to initialise uppy in a useState
but I still get the same error.
This is the new component:
import {Dashboard} from '@uppy/react'
import Uppy from '@uppy/core'
import Tus from '@uppy/tus'
import React, {useState} from 'react'
import '@uppy/core/dist/style.min.css';
import '@uppy/dashboard/dist/style.min.css';
const endpoint = 'http://127.0.0.1:1080/uploads'
function App() {
const [uppy] = useState(() => new Uppy({
debug: true,
logger: {
debug: console.log,
info: console.info,
warn: console.warn,
error: console.error
},
}).use(Tus, {
endpoint,
}));
return (
<Dashboard
uppy={uppy}
width='100vw'
height='calc(100vh - 50px)'
proudlyDisplayPoweredByUppy={false}
/>
)
}
export default App
I'm not sure if I understand the generateUrl
and getFileIdFromRequest
fully,
could it be that the mapping to the file is wrong in one of those functions?
I'll see if I can reproduce with a test
I know this works for Supabase, as can be seen here: https://github.com/supabase/storage/blob/30351a147e2a5d8d4ca0036c2507597793b78c9c/src/http/routes/tus/lifecycle.ts#L81-L143
Maybe that serves as inspiration in the meantime.
I actually already wrote a test for exactly this once:
Maybe remove cors
from your setup?
Removing the cors
middleware will result in cors errors on the client.
I'm not sure why but I have the feeling that the path mapping is not correct when the request comes in.
I will try to copy the supabase setup and see if that makes a difference. Thanks Murderlon
Supabase has a multi-tenant setup so I wouldn't exactly use that. I think your problem is that you use /uploads
on the client but /files
on the server.
That is interesting, does that mean the tus server path has to match the express server path?
Because the express is setting the uploadApp
to the /uploads
endpoint.
I completely missed that. Thank you very much @Murderlon! 🙌
Hi I try to implement the the nested directory example, but when I try to upload via the uppy tus service I get a can't patch error.
This is my test server:
and this is my very basic uppy setup:
Is there any think that I could do wrong that could cause the upload to fail?