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

TypeError: Cannot assign to read only property 'response' of object '[object Object]' #184

Closed
eperitus opened this issue Mar 6, 2020 · 41 comments

Comments

@eperitus
Copy link

eperitus commented Mar 6, 2020

Describe the bug
During a recursive ordered broken link check, blc starts checking and successfully finding broken links, then part of the way through, it hangs, and eventually dumps out a TypeError:

-
/usr/local/lib/node_modules/broken-link-checker/node_modules/bhttp/lib/bhttp.js:159
  err.response = response;
               ^

TypeError: Cannot assign to read only property 'response' of object '[object Object]'
    at addErrorData (/usr/local/lib/node_modules/broken-link-checker/node_modules/bhttp/lib/bhttp.js:159:16)
    at ClientRequest.<anonymous> (/usr/local/lib/node_modules/broken-link-checker/node_modules/bhttp/lib/bhttp.js:567:25)
    at ClientRequest.emit (events.js:316:20)
    at Socket.socketErrorListener (_http_client.js:432:9)
    at Socket.emit (events.js:316:20)
    at emitErrorNT (internal/streams/destroy.js:84:8)
    at processTicksAndRejections (internal/process/task_queues.js:84:21)

To Reproduce
npm install -g broken-link-checker
blc https://example.com -ro

Expected behavior
A completed broken link scan.

Environment:

  • OS and version: macOS Catalina 10.15.3
  • Node.js version: v13.10.1
  • broken-link-checker version: 0.7.8

Possible (terrible) workaround:
Manually go to the last page checked prior to the error, and test each link on that page in your browser. Then remove any links from the page that timeout, for example, links that go to domains that no longer exist.

@jessfraz
Copy link

I got this error as well!

@azam10x
Copy link

azam10x commented Mar 21, 2020

so, i have the same situation

@fharper
Copy link

fharper commented Mar 22, 2020

I have the same problem

@nicholas-schaefer
Copy link

I also have this error

@sznowicki
Copy link

sznowicki commented Mar 27, 2020

I debugged this a little bit and on my end it looks like it breaks once it tries to check link which is behind a VPN. In this case it doesn't receive any response (I believe) and fails in a not graceful way.

My workaround is to exclude the hostname in excludedKeywords option.

@nicholas-schaefer
Copy link

It's not a vpn issue for me. One example of where it crashes is when it tries analyzing the following url "blc https://www.ucc.edu/admissions/federal-aid-programs/ -ro"

@aknilosey
Copy link

got the same issue

@Sutslec
Copy link

Sutslec commented Mar 31, 2020

Same here. It looks like it's all links behind our proxy only urls going through our http(s)_proxy.
We have over 60.000 links to go trough it's not really possible to exclude a certain percentage of them.

@sznowicki
Copy link

I guess it could be handled in a more graceful way, e.x. flag the link as broken with a timeout reason.

@Sutslec
Copy link

Sutslec commented Apr 1, 2020

I guess it could be handled in a more graceful way, e.x. flag the link as broken with a timeout reason.

I'm not really sure if the link is broken. When checking the links where this occurs manually, they do seem to work (even with a curl from the same server). I do agree that just printing an error and exiting isn't the right way of doing this.

@velias
Copy link

velias commented Apr 6, 2020

I have the same problem, but only when -r option is used. What helped me is option like --requests=2 . I'm running checker version 0.7.8 on ubuntu and accessing checked site over VPN.

@c0d3x27
Copy link

c0d3x27 commented Apr 24, 2020

im having the same problem and none of these answers are helping me

@eperitus
Copy link
Author

In the first post, I added a really bad workaround, that at least worked for me:

Manually go to the last page checked prior to the error, and test each link on that page in your browser. Then remove any links from the page that timeout, for example, links that go to domains that no longer exist. Then rescan & repeat.

Of course, this won't be feasible for links that do work but are behind a proxy or accessible via a VPN, etc. But perhaps it will help somebody.

@kmanuel
Copy link

kmanuel commented Apr 27, 2020

I'm having the same problem, but it seems that this originates actually from a problem with the timeout handling of bhttp.
Both adapting the bhttp code or using an older version of bhttp with broken-link-checker (I've only tried it with 1.1.0), fixes the problem for me.

@dbogatov
Copy link

I've got another type error here #196 .

@thiagosanches
Copy link

thiagosanches commented Jun 8, 2020

I've got the same behavior here.

I've tried kmanuel's suggestion and it worked.

@thiagosanches
Copy link

Guys, I just noticed that the new version of blc does not uses the bhttp module anymore, maybe it's time to use the new blc version.

@gauravgandhi1315
Copy link

@kmanuel can you please suggest how to use bhttp with blc? I’m facing same issue. If you can share an example that would be very helpful

@gauravgandhi1315
Copy link

gauravgandhi1315 commented Aug 11, 2020

@thiagosanches Which new version? Latest one is 0.7.8 and I still see issue with this version.

@thiagosanches
Copy link

Hi @gauravgandhi1315 ,
Actually, master branch it's not using the bhttp module anymore. If your look for it on package.json there is no reference:
image

Not sure if master branch attends your needs. I tried to use but it changed a litte bit the application look n' feel.

@gauravgandhi1315
Copy link

@thiagosanches how did you make it work on your machine? Can you share your fix?

@gauravgandhi15
Copy link

gauravgandhi15 commented Aug 13, 2020

@thiagosanches Can you please share how did you see bhttp with blc version 0.7.8? You mentioned in one of your comment that problem solved for you. #184 (comment)

@stevenvachon
Copy link
Owner

I've promised myself to finish v0.8 this fall. It's summer, so I'm doing other things.

Try:

npm install github:stevenvachon/broken-link-checker && cd node_modules/broken-link-checker && npm run build && ./bin/blc

@stevenvachon
Copy link
Owner

The API is different for v0.8

@gauravgandhi15
Copy link

@stevenvachon I am still using 0.7.8. So this error will be there for blc 0.7.8? There is no fix for it?

@stevenvachon
Copy link
Owner

So much has changed from 0.7.8 and bhttp was a problem for a long time. I'm not sure what is causing your issue.

@gauravgandhi15
Copy link

@stevenvachon I get this error only within vpn network. Without vpn, it works fine.

@stevenvachon
Copy link
Owner

bhttp doesn't support proxies.

@gauravgandhi15
Copy link

@stevenvachon Ok, so blc will not work within vpn network. Is there any work around to fix this issue?

@gauravgandhi15
Copy link

@stevenvachon This library works very well except this issue

@stevenvachon
Copy link
Owner

It's been a while, but I think v0.8 (master branch) supports proxies. I remember not figuring out how to automate testing them, though.

@thiagosanches
Copy link

Hey @gauravgandhi15, sorry for the delay.

The mentioned workaround was to change the bhttp module version. You can try to update on your own package.json and force it to use the 1.1.0 version of that module.

@gauravgandhi15
Copy link

@thiagosanches I am not using bhttp. Just using blc 0.7.8

@gauravgandhi15
Copy link

@thiagosanches Can you give an example on how to use bhttp with blc?

@thiagosanches
Copy link

@gauravgandhi15,
That blc version uses the bhttp behind the scenes and its definition is under the package.json file from the blc repo.

So, for example, on my side I've changed it to use the 1.1.0 version of the bhttp module:
image

@gauravgandhi15
Copy link

@thiagosanches after installing blc, it did not install bhttp for me. I tried adding in my package.json. Still seeing same error

@jukkapirinen
Copy link

This seems to fix the problem.
https://git.cryto.net/joepie91/node-bhttp/pulls/5

Now bhttp properly throws the timeout error and blc lists link as broken and does not stop there

ConnectionTimeoutError: The connection timed out.

@ghost
Copy link

ghost commented Sep 10, 2020

@jukkapirinen this solved my issue, thanks!

@gauravgandhi1315
Copy link

gauravgandhi1315 commented Sep 30, 2020

@stevenvachon Any updates on newer version? When are you planning to release it?

@c0d3x27
Copy link

c0d3x27 commented Oct 7, 2020 via email

@joepie91
Copy link

joepie91 commented Dec 5, 2020

Yep, this was caused by a bug in bhttp. I hadn't gotten around to reviewing the PR that fixes it until today. Sorry!

I just released a new version of bhttp, 1.2.8, which includes the fix. It's a patch release, so updating your dependency tree should pull it in automatically, without any changes on @stevenvachon's part being needed.

(That having been said, it seems that the upcoming releases uses got instead of bhttp anyway.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests