500 Error getting large raw file

Using the repository files REST API to get a file around 750MB results in a 500 Internal Server Error. Below is my curl command:

curl --output file.tar.gz --header "PRIVATE-TOKEN: <My Token Here>" "https://gitlab.com/api/v4/projects/<My Project Id>/repository/files/Alpha%2Frelease.tar.gz/raw?ref=master"

I can issue the same command with successful for files less than 250MB. Not sure why larger files result in this issue.

When the error occurs this is the response:

HTTP/2 500
date: Wed, 07 Sep 2022 15:49:44 GMT
content-type: application/json
cache-control: no-cache
content-security-policy: default-src ‘none’
vary: Origin
x-request-id: b7fe93907a476aa345d610384dc14c44
x-runtime: 10.046103
strict-transport-security: max-age=31536000
referrer-policy: strict-origin-when-cross-origin
ratelimit-observed: 3
ratelimit-remaining: 1997
ratelimit-reset: 1662565844
ratelimit-resettime: Wed, 07 Sep 2022 15:50:44 GMT
ratelimit-limit: 2000
gitlab-lb: fe-20-lb-gprd
gitlab-sv: localhost
cf-cache-status: DYNAMIC
report-to: {“endpoints”:[{“url”:“https://a.nel.cloudflare.com/report/v3?s=Y%2Bbn4czndvUEHlNmFJKaFOY8cQRvitd3fGoUX%2FoFj04VEY%2F7s9cxYL4UspDLIku%2FQhqbQ2kzQsoWF2L5DMPH%2BlV8wuJ82Vq2WZwgUNPgn7%2FFWmiEBJNH2mLIE3c%3D”}],“group”:“cf-nel”,“max_age”:604800}
nel: {“success_fraction”:0.01,“report_to”:“cf-nel”,“max_age”:604800}
x-content-type-options: nosniff
server: cloudflare
cf-ray: 747098585b06fe16-DTW

Hi @mmader87
Is your issue resolved?

Yes. I needed to append ‘&lfs=true’ to the url:

curl --output file.tar.gz --header "PRIVATE-TOKEN: <My Token Here>" "https://gitlab.com/api/v4/projects/<My Project Id>/repository/files/Alpha%2Frelease.tar.gz/raw?ref=master&lfs=true"

Hi @mmader87

Thank you for the solution.

However, in my case, the solution works only if the file has the LFS tag.