Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error "Callback was already called." when setting httpHeaders in mlc_config.json #222

Open
ndsvw opened this issue Oct 30, 2022 · 0 comments

Comments

@ndsvw
Copy link

ndsvw commented Oct 30, 2022

I'm trying to check the links in this file (state 30.10.22): https://raw.githubusercontent.com/luong-komorebi/Awesome-Linux-Software/master/README_pt-BR.md

It works fine as long as I don't set HTTP headers in mlc_config.json.

Command: markdown-link-check ./README_pt-BR.md --config ./mlc_config.json (latest version - 3.10.3)

Result:

FILE: ./README_pt-BR.md
/usr/local/lib/node_modules/markdown-link-check/node_modules/async/dist/async.js:324
if (fn === null) throw new Error("Callback was already called.");
^

Error: Callback was already called.
at /usr/local/lib/node_modules/markdown-link-check/node_modules/async/dist/async.js:324:36
at /usr/local/lib/node_modules/markdown-link-check/node_modules/async/dist/async.js:248:17
at /usr/local/lib/node_modules/markdown-link-check/index.js:129:13
at /usr/local/lib/node_modules/markdown-link-check/node_modules/link-check/lib/proto/http.js:117:21
at done (/usr/local/lib/node_modules/markdown-link-check/node_modules/needle/lib/needle.js:548:14)
at PassThrough. (/usr/local/lib/node_modules/markdown-link-check/node_modules/needle/lib/needle.js:811:9)
at PassThrough.emit (node:events:525:35)
at endReadableNT (node:internal/streams/readable:1359:12)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)

Node.js v18.11.0

It works fine with this mlc_config.json:

{
  "timeout": "20s",
  "retryOn429": true,
  "retryCount": 5,
  "config-file": "mlc_config.json",
  "fallbackRetryDelay": "60s",
  "aliveStatusCodes": [200, 206, 403]
}

But it crashes with this mlc_config.json that has httpHeaders specified:

{
  "timeout": "20s",
  "retryOn429": true,
  "retryCount": 5,
  "config-file": "mlc_config.json",
  "fallbackRetryDelay": "60s",
  "aliveStatusCodes": [200, 206, 403],
  "httpHeaders": [
    {
      "urls": ["http", ".", "/"],
      "headers": {
        "User-Agent": "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36",
        "Upgrade-Insecure-Requests": "1",
        "Connection": "keep-alive",
        "Accept-Language": "en-US,en;q=0.5",
        "Accept-Encoding": "gzip, deflate, br",
        "Accept": "text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,*/*;q=0.8"
      }
    }
  ]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant