[go: up one dir, main page]

Skip to content

LFS PDF Preview error with S3 backend and proxy_download off

Summary

If the LFS storage is set to S3 Object Storage, and the proxy_download is set to false (which is the default), then the PDF files uploaded to LFS cannot be previewed.

The error reported by the frontend is An error occurred while loading the file. Please try again later.

The S3 URL given to the frontend works fine as I tried to download that file directly, but the previewing function cannot fetch from that URL for some reason.

Steps to reproduce

  • On a self-hosted instance, use S3 to host LFS file and set proxy_download to false.
  • Upload a PDF with LFS
  • Try to preview that PDF on the Web

Example Project

https://lab.rongyi.io/LER0ever/pdf-preview-issue (public)

There are 4 files in the repo:

  • PDF-Normal.pdf: control group for local PDF file previewing, works fine
  • PDF-LFS.pdf: cannot preview with error mentioned above
  • PNG-Normal.png: control group for local PNG file previewing, works fine
  • PNG-LFS.png: control group for LFS PNG file previewing, works fine

And PDF-LFS.pdf is the only file that cannot be previewed.

PDF-Normal.pdf serves as a control group to show that PDF previewing is working, and PNG-LFS.png serves as a control group for LFS file previewing.

However, I cannot reproduce this issue on GitLab.com, because it seems that GitLab.com has proxy_download set to true, the attempt is at https://gitlab.com/LER0ever/pdf-preview-issue

What is the current bug behavior?

PDF Preview page gives an error:

An error occurred while loading the file. Please try again later.

What is the expected correct behavior?

The preview of that LFS-hosted PDF should appear

Relevant logs and/or screenshots

Output of checks

TLDR: docker omnibus installation, on tag 13.3.0-ee

Results of GitLab environment info

Expand for output related to GitLab environment info

(For installations with omnibus-gitlab package run and paste the output of:
`sudo gitlab-rake gitlab:env:info`)

(For installations from source run and paste the output of:
`sudo -u git -H bundle exec rake gitlab:env:info RAILS_ENV=production`)

root@rongyi-srv-lab:~# docker exec -t root_gitlab_1 gitlab-rake gitlab:env:info

System information
System:
Proxy:          no
Current User:   git
Using RVM:      no
Ruby Version:   2.6.6p146
Gem Version:    2.7.10
Bundler Version:1.17.3
Rake Version:   12.3.3
Redis Version:  5.0.9
Git Version:    2.28.0
Sidekiq Version:5.2.9
Go Version:     unknown

GitLab information
Version:        13.3.0-ee
Revision:       4922d2720ac
Directory:      /opt/gitlab/embedded/service/gitlab-rails
DB Adapter:     PostgreSQL
DB Version:     11.7
URL:            https://lab.rongyi.io
HTTP Clone URL: https://lab.rongyi.io/some-group/some-project.git
SSH Clone URL:  ssh://git@lab.rongyi.io:233/some-group/some-project.git
Elasticsearch:  no
Geo:            no
Using LDAP:     no
Using Omniauth: yes
Omniauth Providers: google_oauth2

GitLab Shell
Version:        13.6.0
Repository storage paths:
- default:      /var/opt/gitlab/git-data/repositories
GitLab Shell path:              /opt/gitlab/embedded/service/gitlab-shell
Git:            /opt/gitlab/embedded/bin/git

Results of GitLab application Check

Expand for output related to the GitLab application check

(For installations with omnibus-gitlab package run and paste the output of: sudo gitlab-rake gitlab:check SANITIZE=true)

(For installations from source run and paste the output of: sudo -u git -H bundle exec rake gitlab:check RAILS_ENV=production SANITIZE=true)

(we will only investigate if the tests are passing)

root@rongyi-srv-lab:~# docker exec -t root_gitlab_1 gitlab-rake gitlab:check SANITIZE=true Checking GitLab subtasks ...

Checking GitLab Shell ...

GitLab Shell: ... GitLab Shell version >= 13.6.0 ? ... OK (13.6.0) Running /opt/gitlab/embedded/service/gitlab-shell/bin/check Internal API available: OK Redis available via internal API: OK gitlab-shell self-check successful

Checking GitLab Shell ... Finished

Checking Gitaly ...

Gitaly: ... default ... OK

Checking Gitaly ... Finished

Checking Sidekiq ...

Sidekiq: ... Running? ... yes Number of Sidekiq processes ... 1

Checking Sidekiq ... Finished

Checking Incoming Email ...

Incoming Email: ... Reply by email is disabled in config/gitlab.yml

Checking Incoming Email ... Finished

Checking LDAP ...

LDAP: ... LDAP is disabled in config/gitlab.yml

Checking LDAP ... Finished

Checking GitLab App ...

Git configured correctly? ... yes Database config exists? ... yes All migrations up? ... yes Database contains orphaned GroupMembers? ... no GitLab config exists? ... yes GitLab config up to date? ... yes Log directory writable? ... yes Tmp directory writable? ... yes Uploads directory exists? ... yes Uploads directory has correct permissions? ... yes Uploads directory tmp has correct permissions? ... yes Init script exists? ... skipped (omnibus-gitlab has no init script) Init script up-to-date? ... skipped (omnibus-gitlab has no init script) Projects have namespace: ... 40/1 ... yes 42/2 ... yes 42/3 ... yes 35/4 ... yes 43/5 ... yes 34/6 ... yes 47/7 ... yes 45/8 ... yes 46/9 ... yes 46/10 ... yes 45/11 ... yes 46/12 ... yes 40/13 ... yes 46/14 ... yes 46/15 ... yes 53/16 ... yes 53/17 ... yes 46/18 ... yes 44/19 ... yes 44/20 ... yes 44/21 ... yes 44/22 ... yes 37/23 ... yes 40/24 ... yes 40/25 ... yes 42/26 ... yes 35/27 ... yes 57/29 ... yes 57/30 ... yes 58/32 ... yes 56/33 ... yes 59/34 ... yes 59/35 ... yes 59/36 ... yes 40/38 ... yes 54/39 ... yes 62/40 ... yes 63/41 ... yes 63/42 ... yes 65/43 ... yes 64/44 ... yes 40/45 ... yes 47/46 ... yes 62/47 ... yes 64/48 ... yes 66/49 ... yes 66/50 ... yes 66/51 ... yes 68/52 ... yes 62/53 ... yes 40/54 ... yes 62/56 ... yes 52/57 ... yes 62/58 ... yes 71/59 ... yes 71/60 ... yes 40/61 ... yes 57/62 ... yes 73/63 ... yes 73/64 ... yes 40/65 ... yes 40/66 ... yes 40/67 ... yes 72/68 ... yes 72/69 ... yes 40/70 ... yes 40/71 ... yes 43/72 ... yes 43/73 ... yes 72/74 ... yes 80/75 ... yes 80/76 ... yes 80/77 ... yes 80/78 ... yes 80/79 ... yes 80/80 ... yes 62/81 ... yes 57/82 ... yes 62/83 ... yes 73/84 ... yes 82/85 ... yes 56/86 ... yes 57/87 ... yes 72/88 ... yes 56/89 ... yes 82/90 ... yes 84/91 ... yes 85/92 ... yes 82/93 ... yes 65/94 ... yes 92/95 ... yes 84/96 ... yes 84/97 ... yes 84/98 ... yes 68/99 ... yes 87/100 ... yes 87/101 ... yes 73/102 ... yes 57/103 ... yes 63/104 ... yes 56/105 ... yes 78/106 ... yes 88/107 ... yes 73/108 ... yes 82/109 ... yes 89/110 ... yes 82/111 ... yes 82/112 ... yes 52/113 ... yes 45/114 ... yes 57/115 ... yes 91/116 ... yes 91/117 ... yes 46/118 ... yes 46/119 ... yes 92/120 ... yes 92/121 ... yes 92/122 ... yes 92/123 ... yes 92/124 ... yes 90/125 ... yes 60/126 ... yes 60/127 ... yes 60/128 ... yes 91/129 ... yes 71/130 ... yes 71/131 ... yes 80/132 ... yes 40/133 ... yes 40/134 ... yes 40/135 ... yes 41/136 ... yes 41/137 ... yes 93/138 ... yes 35/139 ... yes Redis version >= 4.0.0? ... yes Ruby version >= 2.5.3 ? ... yes (2.6.6) Git version >= 2.24.0 ? ... yes (2.28.0) Git user has default SSH configuration? ... yes Active users: ... 1 Is authorized keys file accessible? ... yes GitLab configured to store new projects in hashed storage? ... yes All projects are in hashed storage? ... yes Elasticsearch version 6.x - 7.x? ... skipped (elasticsearch is disabled)

Checking GitLab App ... Finished

Checking GitLab subtasks ... Finished

Possible fixes

Edited by LER0ever