How does an uploaded file get from uppy companion to tusd?

I just about have companion working but there is a crucial step I’m missing… Uploads from the local filesystem work fine direct to tusd.

When I upload a file from google drive, it makes it to companion scratch space, but never gets transferred to tusd.(the reference solution). The upload hangs forever, even though companion has a complete copy.

Both companion and tusd are behind NGINX reverse proxy.

Does the request to transfer the file from companion to tusd come directly from companion? If so, I am giving companion the wrong tusd address.

Thanks!

A few more details:
In the JS-client script:

uppy.use(Uppy.Tus, { endpoint: 'https://cuahsi-dev-1.hydroshare.org/upload/' });
...
uppy.use(Uppy.GoogleDrive, {
  target: Uppy.Dashboard,
  companionUrl: 'https://cuahsi-dev-1.hydroshare.org/companion/'
});

In NGINX.conf:

    location /upload/ {
        # doesn't work for some reason involving docker networking setup:
        proxy_pass http://tusd:1080;
        ...
    }
    location /companion/ {
        proxy_pass http://uppy:3020/;
        ...
    }

The symbols tusd and uppy are defined in /etc/hosts.
In starting up tusd,

/usr/local/bin/tusd -base-path /upload/ -behind-proxy

What I think I’m doing is to expose tusd as https://cuahsi-dev-1.hydroshare.org/upload and companion as https://cuahsi-dev-1.hydroshare.org/companion.

The problem is that – according to the JavaScript debugging console, the tusd URL that is given to companion is the same external one that is declared to the js-client. Since companion is running behind a proxy, it can’t contact tusd that way.

I think the way I have to fix this is to make it possible for companion to contact `tusd’ via the public URL even though it is behind the proxy. Is this correct?

A few more details:

In the js-client invocation:

uppy.use(Uppy.Tus, { endpoint: 'https://cuahsi-dev-1.hydroshare.org/upload/' });

uppy.use(Uppy.GoogleDrive, {
  target: Uppy.Dashboard,
  companionUrl: 'https://cuahsi-dev-1.hydroshare.org/companion/'
});

In NGINX configuration:

    location /upload/ {
        proxy_pass http://tusd:1080;
        ...
    }
    location /companion/ {
        proxy_pass http://uppy:3020/;
        ...
    }

Where tusd and uppy are in /etc/hosts.

To initialize tusd,

/usr/local/bin/tusd -base-path /upload/ -behind-proxy 

To initialize companion:

export COMPANION_IMPLICIT_PATH="/companion"
...
companion

What I think I am doing is to

  1. Provide tusd at https://cuahsi-dev-1.hydroshare.org/upload/
  2. Provide companion at https://cuahsi-dev-1.hydroshare.org/companion/

The JavaScript console tells me that when companion is called, the external address of upload is being passed.

What I think I need to do is to arrange /etc/hosts so that the external address points to the internal one in /etc/hosts. Is this correct?

I’m having incredible trouble convincing uppy companion, that tusd is running at a subURL https://cuahsi-dev-1.hydroshare.org/upload/... It seems to strip that off and redirects to https://cuahsi-dev-1.hydroshare.org/connect/... URL without the upload prefix.

Is there any way I can convince if to use that prefix when working through the callbacks after google drive authentication and permission?

It seems that in a lot of ways, uppy companion presumes that tusd is running at the root of the hrml hierarchy…

Hi, I’m not too sure what is required here but I have let @marius and Mikeal know about this. Perhaps they can shed some light.

Hello @alvacouch, have you configured tusd and nginx exactly according to tusd/faq.md at master · tus/tusd · GitHub?
Are there logs from Companion and tusd you can share?

Does it work if you assign one subdomain for each companion and tusd? If not, does it work if you try to instead upload to Transloadit’s demo tus tusd.tusdemo.net?