[GH-ISSUE #250] Github actions download jobs failed #79

Closed
opened 2026-03-04 00:23:43 +03:00 by kerem · 4 comments
Owner

Originally created by @trungking on GitHub (Sep 27, 2022).
Original GitHub issue: https://github.com/SignTools/SignTools/issues/250

I tried basic troubleshooting first

Describe the bug

Download job by using download.js and EasyDl failed with error

error: Failed to download chunk #0 undefined

image

I had to rewrite download.js using axios to get it works.

const { exit } = require("process");
const axios = require('axios').default;
const fs = require('fs');

(async function (){
  var args = process.argv.slice(2);
  if (args.length != 3) {
    console.log("Usage: download.js DOWNLOAD_URL KEY OUTPUT_FILE");
    exit(1);
  }
  
  var downloadUrl = args[0];
  var key = args[1];
  var outputFile = args[2];
  
  await downloadFile(downloadUrl, key, outputFile);
}());


async function downloadFile(url, key, outputFile) {
  const { data, headers } = await axios({
      url: url,
      method: "GET",
      headers: {
        "Authorization": "Bearer " + key
      },
      responseType: "stream",
  });

  const contentLength = headers['content-length'];

  console.log(contentLength)

  data.on('data', (chunk) => {
      // console.log(chunk)
  })

  data.pipe(fs.createWriteStream(outputFile))
}

Also install signed IPA give me the manifest with http(missing s) link which is unable to install so i have to add

proxy_set_header X-Forwarded-Proto $scheme;

to nginx to get the https link

Everything is working now so i just leave this here if anyone have the same problem

Originally created by @trungking on GitHub (Sep 27, 2022). Original GitHub issue: https://github.com/SignTools/SignTools/issues/250 **I tried basic troubleshooting first** - [x] Updated **both** [SignTools](https://github.com/SignTools/SignTools) **and** the builder ([SignTools-CI](https://github.com/SignTools/SignTools-CI) or [SignTools-Builder](https://github.com/SignTools/SignTools-Builder)) to the latest version - [x] Read through the [FAQ page](https://github.com/SignTools/SignTools/blob/master/FAQ.md) **Describe the bug** Download job by using `download.js` and `EasyDl` failed with error `error: Failed to download chunk #0 undefined` ![image](https://user-images.githubusercontent.com/18730477/192566468-11736fde-5d78-4032-9f46-e4deb2050fd4.png) I had to rewrite download.js using axios to get it works. ```javascript const { exit } = require("process"); const axios = require('axios').default; const fs = require('fs'); (async function (){ var args = process.argv.slice(2); if (args.length != 3) { console.log("Usage: download.js DOWNLOAD_URL KEY OUTPUT_FILE"); exit(1); } var downloadUrl = args[0]; var key = args[1]; var outputFile = args[2]; await downloadFile(downloadUrl, key, outputFile); }()); async function downloadFile(url, key, outputFile) { const { data, headers } = await axios({ url: url, method: "GET", headers: { "Authorization": "Bearer " + key }, responseType: "stream", }); const contentLength = headers['content-length']; console.log(contentLength) data.on('data', (chunk) => { // console.log(chunk) }) data.pipe(fs.createWriteStream(outputFile)) } ``` Also install signed IPA give me the manifest with http(missing s) link which is unable to install so i have to add `proxy_set_header X-Forwarded-Proto $scheme;` to nginx to get the https link Everything is working now so i just leave this here if anyone have the same problem
kerem 2026-03-04 00:23:43 +03:00
  • closed this issue
  • added the
    bug
    label
Author
Owner

@ViRb3 commented on GitHub (Sep 27, 2022):

error: Failed to download chunk #0 undefined

Most likely an issue with your reverse proxy setup, it works great for me with nginx and for everyone else on Heroku. Check your nginx logs to see what's going on. Make sure the HEAD method is allowed in addition to GET. EasyDl uses parallel chunked downloads, which can be much faster than plain axios depending on the network conditions.

Also install signed IPA give me the manifest with http(missing s) link which is unable to install so i have to add...

You should be able to fix this by setting the Host header, did you try that? Described in the docs:
https://github.com/SignTools/SignTools/blob/master/INSTALL-ADVANCED.md#4a-reverse-proxy

<!-- gh-comment-id:1259812878 --> @ViRb3 commented on GitHub (Sep 27, 2022): > error: Failed to download chunk #0 undefined Most likely an issue with your reverse proxy setup, it works great for me with nginx and for everyone else on Heroku. Check your nginx logs to see what's going on. Make sure the HEAD method is allowed in addition to GET. EasyDl uses parallel chunked downloads, which can be much faster than plain axios depending on the network conditions. > Also install signed IPA give me the manifest with http(missing s) link which is unable to install so i have to add... You should be able to fix this by setting the `Host` header, did you try that? Described in the docs: https://github.com/SignTools/SignTools/blob/master/INSTALL-ADVANCED.md#4a-reverse-proxy
Author
Owner

@trungking commented on GitHub (Sep 27, 2022):

Most likely an issue with your reverse proxy setup, it works great for me with nginx and for everyone else on Heroku. Check your nginx logs to see what's going on. Make sure the HEAD method is allowed in addition to GET. EasyDl uses parallel chunked downloads, which can be much faster than plain axios depending on the network conditions.

I don't know what could be wrong but it just an basic nginx reverse proxy setup, nothing extra

location / {
  proxy_pass http://127.0.0.1:8080;
  
  proxy_set_header Host $http_host;
  proxy_set_header X-Forwarded-Proto $scheme;
}

You should be able to fix this by setting the Host header, did you try that? Described in the docs: https://github.com/SignTools/SignTools/blob/master/INSTALL-ADVANCED.md#4a-reverse-proxy

I did use Host header just like in the document and it give http link.

Everything is working now so you can close this, just leave it here in case some one need it for their setup

<!-- gh-comment-id:1259825980 --> @trungking commented on GitHub (Sep 27, 2022): > Most likely an issue with your reverse proxy setup, it works great for me with nginx and for everyone else on Heroku. Check your nginx logs to see what's going on. Make sure the HEAD method is allowed in addition to GET. EasyDl uses parallel chunked downloads, which can be much faster than plain axios depending on the network conditions. I don't know what could be wrong but it just an basic nginx reverse proxy setup, nothing extra ``` location / { proxy_pass http://127.0.0.1:8080; proxy_set_header Host $http_host; proxy_set_header X-Forwarded-Proto $scheme; } ``` > You should be able to fix this by setting the `Host` header, did you try that? Described in the docs: https://github.com/SignTools/SignTools/blob/master/INSTALL-ADVANCED.md#4a-reverse-proxy I did use Host header just like in the document and it give http link. Everything is working now so you can close this, just leave it here in case some one need it for their setup
Author
Owner

@ViRb3 commented on GitHub (Sep 29, 2022):

Going to investigate the header issue, just haven't had the time. My nginx is very customized so you may be right that the protocol header is also needed.

<!-- gh-comment-id:1262438157 --> @ViRb3 commented on GitHub (Sep 29, 2022): Going to investigate the header issue, just haven't had the time. My nginx is very customized so you may be right that the protocol header is also needed.
Author
Owner

@Isrofilov commented on GitHub (Oct 20, 2022):

I have the same error. I tried the solution rewrite download.js, but it did not help me

upd. the problem was found in the authorization.
docker, on restart removes quotes in fields in basic_auth: username, password
and the github as a result cannot pass authorization

<!-- gh-comment-id:1285306575 --> @Isrofilov commented on GitHub (Oct 20, 2022): I have the same error. I tried the solution rewrite download.js, but it did not help me upd. the problem was found in the authorization. docker, on restart removes quotes in fields in basic_auth: username, password and the github as a result cannot pass authorization
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/SignTools#79
No description provided.