[Metabase 0.47.0] Query Results cannot download

Hi All,

I cannot download query results for all the options, .csv,.xlsx or json. All the results are downloaded with the same file size and you open the file, it is corrupted.

{
"browser-info": {
"language": "en-US",
"platform": "Win32",
"userAgent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36",
"vendor": "Google Inc."
},
"system-info": {
"file.encoding": "UTF-8",
"java.runtime.name": "OpenJDK Runtime Environment",
"java.runtime.version": "11.0.20+8-post-Ubuntu-1ubuntu122.04",
"java.vendor": "Ubuntu",
"java.vendor.url": "https://ubuntu.com/",
"java.version": "11.0.20",
"java.vm.name": "OpenJDK 64-Bit Server VM",
"java.vm.version": "11.0.20+8-post-Ubuntu-1ubuntu122.04",
"os.name": "Linux",
"os.version": "5.19.0-50-generic",
"user.language": "en",
"user.timezone": "Africa/Lusaka"
},
"metabase-info": {
"databases": [
"clickhouse",
"mysql"
],
"hosting-env": "unknown",
"application-database": "mysql",
"application-database-details": {
"database": {
"name": "MariaDB",
"version": "10.6.12-MariaDB-0ubuntu0.22.04.1"
},
"jdbc-driver": {
"name": "MariaDB Connector/J",
"version": "2.7.6"
}
},
"run-mode": "prod",
"version": {
"date": "2023-08-16",
"tag": "v0.47.0",
"branch": "release-x.47.x",
"hash": "682ec2d"
},
"settings": {
"report-timezone": null
}
}
}

EDIT

The problem seems to be a cache on the browser, accessing Metabase using the IP rather than the URL the download works fine.

Try changing the site url, that might be the error

By changing the URL you mean having a completely new one? For your information, I am running Metabase on a subdomain with a subpath.

@Luiggi this is the output I'm getting in the downloaded .csv file.

<html>
<head><title>404 Not Found</title></head>
<body>
<center><h1>404 Not Found</h1></center>
<hr><center>nginx/1.18.0 (Ubuntu)</center>
</body>
</html>
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->
<!-- a padding to disable MSIE and Chrome friendly error page -->

If it’s a 404 then maybe there’s a problem with the endpoints in nginx. Can you post nginx config?

Hi, @Luiggi below is a deducted version of the nginx config.

server {
    listen [::]:80;
    listen 80;

    server_name analytics.example.com www.analytics.example.com 192.500.60.192;

    return 301 https://analytics.example.com$request_uri;
}

map $http_upgrade $connection_upgrade {
  default upgrade;
  ''      close;
}

server {
    listen [::]:443 ssl;
    listen 443 ssl;

    server_name analytics.example.com www.analytics.example.com 192.500.60.192;

    location / {
            root   /var/www/html/;
            index  index.html index.htm;
        }

    location /metabase/ {
        proxy_pass http://127.0.0.1:6000/;
        proxy_http_version 1.1;
        proxy_set_header Upgrade $http_upgrade;
        proxy_set_header Connection $connection_upgrade;
}
    ssl_certificate /etc/metabase-cert/certificate.crt;
    ssl_certificate_key /etc/metabase-cert/private.key;
}

I would check the nginx logs to see if you’re hitting the correct endpoint when calling the exports endpoint

@Luiggi When I invoke the download, I have the following line in the access.log for Nginx

[23/Aug/2023:16:17:01 +0200] "POST /metabase/api/dataset HTTP/1.1" 202 382186

for unsuccessful download.

Below is the message when I access via IP address and a successful download

[23/Aug/2023:16:17:04 +0200] "GET /metabase/api/database/7 HTTP/1.1" 200 814
[23/Aug/2023:16:17:05 +0200] "GET /metabase/app/assets/img/blue_check.png HTTP/1.1" 200 815

I have checked the error.log too. I believe this line, gives the clue.

[error] 234606#234606: *140 open() "/var/www/html/api/card/111/query/xlsx" failed (2: No such file or directory)

Here you have the problem, clearly an error in your nginx

Yes, this path /var/www/html/ contains an html landing page, and then metabase is served on /metabase/ subpath of the subdomain.

So an html is a static resource and an api is a dynamic resource

I think that the configuration of Apache is wrong here, can you please review it?

We are also having the same issue. CSVs download with a 404 error message. They were working for us before 0.47.0.

I just upgraded to 0.47.1 and I'm still getting 404s. In our case, we're running Metabase in Kubernetes with Traefik as our proxy.

你 下载的情况恢复了么 ? 我也出现了同样的问题呢