How to use uploaded files?

Hello,

I try to use uploaded file with tus in front side, but I can’t.

Client

this.uppy = new Uppy({
            id           : 'uppy-input',
            autoProceed  : true,
            locale       : this.getUppyTranslations(props.i18n.language),
            debug        : true,
            restrictions : {
                maxFileSize      : 1000000,
                maxNumberOfFiles : 1,
                allowedFileTypes : ['image/*'],
            },
        })
            .use(Webcam)
            .use(Instagram, {
                companionUrl : process.env.REACT_APP_SERVER_URL,
            })
            .use(Tus, {
                endpoint                   : `${process.env.REACT_APP_SERVER_URL}/uploads`,
                resume                     : true,
                removeFingerprintOnSuccess : true,
                limit                      : 1,
            });
    this.uppy.on('upload-success', (file, response) => {
                console.log(file);
                console.log(response);
                var img = new Image()
                img.width = 300
                img.alt = file.id
                img.src = response.uploadURL
                document.body.appendChild(img)
            });

“response.uploadURL” return nothing, when I call it, I receive a 404 error

Server

const server = new tus.Server();
server.datastore = new tus.FileStore({
    path : '/files',
});

server.on(tus.EVENTS.EVENT_UPLOAD_COMPLETE, (event) => {
    console.log(`Upload complete for file ${event.file.id}`);
});
server.on(tus.EVENTS.EVENT_ENDPOINT_CREATED, (event) => {
    console.log('New endpoint', event);
});
dotenv.config();

const { PORT } = process.env;

const app = express();

app.set('port', PORT || 8080);


const uploadApp = express();
uploadApp.all('*', server.handle.bind(server));
app.use('/uploads', uploadApp);

app.use(bodyParser.json());
app.use(bodyParser.urlencoded({ extended : false }));

app.listen(PORT, () => {
    logger.info(`App listening on port ${PORT}!`);
});

Someone can help me to undestand why ?
Thanks in advance

Hello there. Sorry for the late response, but if this is still an issue, I should be able to shed some light on this.

Is the upload completing properly? What does the response object look like?

My assumption is that the request is just failing and therefore, no uploadURL is sent. From reading the type definitions that dictate the what types the uploadURL can be, it can be either a string or undefined.

I hope I can help. If you have any further issues or questions, let me know.

- Andrew