File Uploads Error -Invalid response code 0

Hi
I have an instance of Specify (docker-based) running at the machine ‘docker-tst1’ (accessible via https://boya-dev.csiro.au). When I upload a file, the system outputs errors as below:

I tested the URL of https://boya-dev.csiro.au/web_asset_store.xml. web_asset_store.xml is being rewritten but still not able to upload:

Based on this config for ngnix:
Nginx proxy for Specify web asset server providing HTTPS. (github.com)

Apache config:
<Location “/web_asset_store.xml”>
ProxyPass http://docker-tst1:8080/web_asset_store.xml
ProxyPassReverse http://docker-tst1:8080/web_asset_store.xml
AddOutputFilterByType SUBSTITUTE text/xml
Substitute “s|http://boya-dev.csiro.au:8080|https://boya-dev.csiro.au|ni

I attach the crash report and docker-compose file. Any help resolving the issue would be great. Thanks…
Specify 7 Crash Report - 2023-12-20T10 43 57.713Z.txt (372.6 KB)
docker-compose.yml (4.4 KB)

Apache looks good, although we can do without it.

Was the Apache running when you started ctr-specify7-boya-dev.csiro.au container or did you run Apache afterward? If you started Apache afterwards,
can you try restarting the specify7ctr-specify7-boya-dev.csiro.au (main specify7) container? This is because specify7 fetches the settings (the URLs) for asset server when starting, and doesn’t make subsequent requests. So, restarting the specify7 container should do the trick, if Apache was started after specify7.

However, a better way is to use specifyconsortium/specify-asset-service:connection_fix as it updates the XML file to use https. The asset-service part should look like below. Note the change in SERVER_PORT

  svc-asset-server-boya-dev.csiro.au:
    container_name: ctr-asset-server-boya-dev.csiro.au
    hostname: asset-server
    domainname: local.domain
    restart: unless-stopped
    image: specifyconsortium/specify-asset-service:connection_fix
    init: true
    volumes:
      - "attachments:/home/specify/attachments"
    environment:
      - SERVER_NAME=boya-dev.csiro.au
      - SERVER_PORT=443
      - ATTACHMENT_KEY=&789456&
      - DEBUG_MODE=true

Hello Vinayakjha,

Firstly. thanks for response! I am helping Anu, to get the containers started.

I have made the change you propose but now I get errors:
vc-nginx-boya-dev.csiro.au_1 | 2023/12/20 22:36:02 [error] 22#22: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.19.0.2, server: localhost, request: “GET /web_asset_store.xml HTTP/1.1”, upstream: “http://172.19.0.8:8080/web_asset_store.xml”, host: “boya-dev.csiro.au”
svc-nginx-boya-dev.csiro.au_1 | 172.19.0.2 - - [20/Dec/2023:22:36:02 +0000] “GET /web_asset_store.xml HTTP/1.1” 502 157 “-” “python-requests/2.28.1” “172.19.0.10”
ctr-specify7-worker-boya-dev.csiro.au | [20/Dec/2023 22:36:02] [ERROR] [specifyweb.attachment_gw.views:212] Failed fetching asset server configuration

What should I be setting the ASSET_SERVER_URL?

docker-compose.yml-21122023.yml (5.5 KB)

Regards,
Dan.

set it to https://boya-dev.csiro.au/web_asset_store.xml in specify7 and worker environment.

Thanks Vinayakja, I have changed the variable too for both specify7 and worker containers:

ASSET_SERVER_URL=https://boya-dev.csiro.au/web_asset_store.xml

But still get the following errors:
svc-nginx-boya-dev.csiro.au_1 | 2023/12/21 02:48:27 [error] 21#21: *1 connect() failed (111: Connection refused) while connecting to upstream, client: 172.19.0.2, server: localhost, request: “GET /web_asset_store.xml HTTP/1.1”, upstream: “http://172.19.0.4:8080/web_asset_store.xml”, host: “boya-dev.csiro.au”
svc-nginx-boya-dev.csiro.au_1 | 172.19.0.2 - - [21/Dec/2023:02:48:27 +0000] “GET /web_asset_store.xml HTTP/1.1” 502 157 “-” “python-requests/2.28.1” “172.19.0.8”
ctr-specify7-worker-boya-dev.csiro.au | [21/Dec/2023 02:48:27] [ERROR] [specifyweb.attachment_gw.views:212] Failed fetching asset server configuration

If I attempt to access that URL manually I get:

502 Bad Gateway

Error logs:
svc-nginx-boya-dev.csiro.au_1 | 172.19.0.2 - - [21/Dec/2023:02:52:06 +0000] “GET /web_asset_store.xml HTTP/1.1” 502 559 “-” “Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36 Edg/120.0.0.0” “138.194.34.81”
svc-nginx-boya-dev.csiro.au_1 | 2023/12/21 02:52:06 [error] 20#20: *4 connect() failed (111: Connection refused) while connecting to upstream, client: 172.19.0.2, server: localhost, request: “GET /web_asset_store.xml HTTP/1.1”, upstream: “http://172.19.0.3:8080/web_asset_store.xml”, host: “boya-dev.csiro.au”

Hey Dan,

I apologize as using the different version of specify-asset-service:connection_fix didn’t fix it for me when I tried replicating your setup. I experienced the same problem you are experiencing.

We are changing the code, which will fix the issue once it is available on the docker hub.

Here is something that will work for now:

  1. Store the following attached file web_asset_store.xml file in the same directory as your docker-compose.yml configuration.
  2. Put the following as your asset-server service block (with the keys put in)
  svc-asset-server-boya-dev.csiro.au:
    container_name: ctr-asset-server-boya-dev.csiro.au
    hostname: asset-server
    domainname: local.domain
    restart: unless-stopped
    image: specifyconsortium/specify-asset-service
    init: true
    volumes:
      - "attachments:/home/specify/attachments"
      - "./web_asset_store.xml:/home/specify/web_asset_store.xml"
    environment:
      - SERVER_NAME=boya-dev.csiro.au
      - SERVER_PORT=443
      - ATTACHMENT_KEY=&789456&
      - DEBUG_MODE=true
  1. Restart the containers

Here is the web_asset_store.xml file to use.
web_asset_store.xml (385 Bytes)

1 Like

it works, thank you :pray:

Hi Vinayakjha,

That is fantastic! I made the change and unwound the Apache changes and it worked.

Have a good Xmas break.