maxlath / wikibase-cli

read and edit a Wikibase instance from the command line
MIT License
226 stars 24 forks source link

Some commands throw `Error: 403 Forbidden` #80

Closed tombaker closed 4 years ago

tombaker commented 5 years ago

I used npm to install wd on MacOS 10.14.5 and on Ubuntu 18.04. On both platforms, some of the commands throw Error: 403 Forbidden after providing correct output:

$ wd summary Q1
id Q1
Label Universe
Description totality of space and all contents
Error: 403 Forbidden
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/wikidata-cli/lib/light_get.js:43:15)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:138:11)
    at process._tickCallback (internal/process/next_tick.js:180:9)
Context: undefined
Response Body <html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.13.6</center>
</body>
</html>

Two commands that throw errors are summary and claims. The commands search, description, revisions, help, id, and label work fine.

I got the output above on Ubuntu. On MacOS, the output is similar but not identical:

...
Error: 403 Forbidden
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/wikidata-cli/lib/light_get.js:43:15)
    at IncomingMessage.emit (events.js:187:15)
    at endReadableNT (_stream_readable.js:1091:14)
    at process._tickCallback (internal/process/next_tick.js:174:19)
...
maxlath commented 5 years ago

which version are you using? this is seems very likely to be related to #79

tombaker commented 5 years ago

On Mon, Jul 01, 2019 at 12:19:58AM -0700, Maxime Lathuilière wrote:

which version are you using? this is seems very likely to be related to #79

On both platforms: 7.5.1.

-- Tom Baker tom@tombaker.org

DennisTobola commented 5 years ago

This error occurs on node version 10.15.2 and Ubuntu version 19.04 as well.

maxlath commented 5 years ago

@tombaker @DennisTobola could you retry with v7.5.3? requests using the light_get were still sent without user-agent, that has been corrected

tombaker commented 5 years ago

@maxlath After upgrading to v7.5.31 on MacOS, the commands wd search and wd claims now work. I was unable to get it to work on Ubuntu 18.04. It wanted me to make sure I had the latest versions of node.js and npm, but sudo npm install npm@latest -g exited with SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode.

I mostly work on MacOS, so this solves the most immediate problem for me.

nmaynes commented 5 years ago

The docker image is still throwing the error. If you want to push the latest, I am happy to verify that the error is resolved.

maxlath commented 5 years ago

@nmaynes v7.5.3 is now available on Docker

nmaynes commented 5 years ago

@maxlath Thanks for jumping on this so quickly. I went ahead and tested it. The issue seems to persist.

nmaynes@docker:~$ alias wd='sudo docker run --rm --volume "$HOME/.local/share/wikidata-cli:/wikidata-cli/local" -t maxlath/wikidata-cli:latest'
nmaynes@docker:~$ wd summary Q1
id Q1
Label Universe
Description totality of space and all contents
Error: 403 Forbidden
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/wikidata-cli/lib/light_get.js:43:15)
    at emitNone (events.js:111:20)
    at IncomingMessage.emit (events.js:208:7)
    at endReadableNT (_stream_readable.js:1064:12)
    at _combinedTickCallback (internal/process/next_tick.js:139:11)
    at process._tickCallback (internal/process/next_tick.js:181:9)
Context: undefined
Response Body <html>
<head><title>403 Forbidden</title></head>
<body bgcolor="white">
<center><h1>403 Forbidden</h1></center>
<hr><center>nginx/1.13.6</center>
</body>
</html>

If something about my commands looks off, let me know. On my set up I do need to run docker as root. I don't know if that would impact the way the container is orchestrated.

maxlath commented 5 years ago

@nmaynes there was an issue with the docker image build process, which was installing an old version of the package; that should now have been fixed (bc9c100) and published as v7.5.4

nmaynes commented 5 years ago

Thanks @maxlath the latest docker image appears to have the fix in place. I will be testing a few other commands on it this afternoon and let you know if something else is not working.