mariusor/brutalinks

Cannot start littr: "Internal Server Error - Unable to load the Service's inbox"

Closed this issue · 7 comments

Hello,

I'm trying to set up fedbox and littr. After littr starts, it shows the error message

Internal Server Error
Unable to load the Service's inbox

on the homepage.

I'm on current master on both repos (commit f237ecaf0def98c3d3915f6199b025b99bee16da for fedbox, and 865ec37 on littr), running on ubuntu server 20.04 with "go version go1.13.8 linux/amd64".

I have an nginx that's reverse proxying http://fedbox.local to http://localhost:4000, and http://littr.local to http://localhost:3000. Both hosts are also in my /etc/hosts file and point to 127.0.0.1.

fedbox .env file:

HOSTNAME=fedbox.local
LISTEN=localhost:4000
ENV=dev
STORAGE=boltdb
STORAGE_PATH=/var/www/fedbox/storage/

fedbox install commands:

mkdir /var/www/fedbox/storage
./bin/ctl bootstrap
./bin/ctl ap actor add admin
./bin/ctl oauth client add --redirectUri=http://littr.local/auth/fedbox/callback

littr .env file:

HOSTNAME=fedbox.local
LISTEN_HOST=127.0.0.1
LISTEN_PORT=3000
ENV=dev
API_URL=http://fedbox.local
SESS_AUTH_KEY=...
SESS_ENC_KEY=...
# Client ID received from the "oauth client add" command
OAUTH2_KEY=192952fd-aa14-401e-9f73-215416cd426b
# Secret i entered into the "oauth client add" command
OAUTH2_SECRET=...
SESS_BACKEND=cookie
DISABLE_SESSIONS=false
DISABLE_DOWNVOTING=false
DISABLE_VOTING=false

fedbox log:

INFO[0000] Listening on localhost:4000
INFO[0005] OK                                            addr="127.0.0.1:42240" elapsed=1.357457ms id=chalet/t4IJzIHzeF-000001 len=561 method=GET proto=HTTP/1.1 scheme=http status=200 ts="Fri, 03 Jul 2020 12:38:17 UTC" ua=chalet.local-865ec37-git uri="http://fedbox.local/actors/192952fd-aa14-401e-9f73-215416cd426b"
INFO[0005] OK                                            addr="127.0.0.1:42242" elapsed=85.821488ms id=chalet/t4IJzIHzeF-000002 len=126 method=POST proto=HTTP/1.1 scheme=http status=200 ts="Fri, 03 Jul 2020 12:38:17 UTC" ua=Go-http-client/2.0 uri="http://fedbox.local/oauth/token"
INFO[0005] OK                                            addr="127.0.0.1:42244" elapsed="829.615µs" id=chalet/t4IJzIHzeF-000003 len=1561 method=GET proto=HTTP/1.1 scheme=http status=200 ts="Fri, 03 Jul 2020 12:38:17 UTC" ua=chalet.local-865ec37-git uri="http://fedbox.local/actors?type=Person&type=Service&type=Group&type=Application&type=Organization"
ERRO[0005] Not Found                                     addr="127.0.0.1:42246" elapsed=1.567971ms id=chalet/t4IJzIHzeF-000004 len=6837 method=GET proto=HTTP/1.1 scheme=http status=404 ts="Fri, 03 Jul 2020 12:38:17 UTC" ua=chalet.local-865ec37-git uri="http://fedbox.local/objects?context=-&type=Article&type=Note&type=Link&type=Page&type=Document&type=Video&type=Audio"
ERRO[0005] Not Found                                     addr="127.0.0.1:42248" elapsed=1.709308ms id=chalet/t4IJzIHzeF-000005 len=6837 method=GET proto=HTTP/1.1 scheme=http status=404 ts="Fri, 03 Jul 2020 12:38:17 UTC" ua=chalet.local-865ec37-git uri="http://fedbox.local/objects?type=Article&type=Note&type=Link&type=Page&type=Document&type=Video&type=Audio"

littr log:

ERRO[0000] https://fedbox.local/objects?context=-&type=Article&type=Note&type=Link&type=Page&type=Document&type=Video&type=Audio: Unable to load from the AP end point: invalid status 404
ERRO[0000] https://fedbox.local/objects?type=Article&type=Note&type=Link&type=Page&type=Document&type=Video&type=Audio: Unable to load from the AP end point: invalid status 404
INFO[0000] Started                                       env="" host=littr.local listen="localhost:3000"

These logs indicate that littr can talk to fedbox, but some of these requests fail with error 404 (the /objects requests). When I open littr in the browser, the internal server error appears, and the following lines are logged:

fedbox log:

ERRO[0253] Not Found                                     addr="127.0.0.1:42254" elapsed=1.509747ms id=chalet/t4IJzIHzeF-000006 len=6826 method=GET proto=HTTP/1.1 scheme=http status=404 ts="Fri, 03 Jul 2020 12:42:26 UTC" ua=littr.local-865ec37-git uri="http://fedbox.local/inbox?maxItems=25&object.context=-&object.type=Article&object.type=Note&object.type=Link&object.type=Page&object.type=Document&object.type=Video&object.type=Audio&type=Create

littr log:

ERRO[0248] http://fedbox.local/inbox?maxItems=25&object.context=-&object.type=Article&object.type=Note&object.type=Link&object.type=Page&object.type=Document&object.type=Video&object.type=Audio&type=Create: Unable to load from the AP end point: invalid status 404
INFO[0248] OK                                            duration=36.655065ms host=littr.local https=false id=chalet/Gk0eG0dQbT-000001 length=17717 met=GET proto=HTTP/1.1 status=200 uri=/

It seems to me that littr is set up correctly, but some data is missing in fedbox, so that it can't respond to the /objects and /inbox requests. Any help would be appreciated.

Hmm, for the boltdb storage backend you need to bootstrap the fedbox db, this step basically creates the collections for actors, activities, objects.

Check the ./bin/ctl bootstrap command. Probably it will be removed at one point when the step of creating the collections will be automated, like the badger and fs backends have now, but not yet.

If you're just planning to test, I would suggest to use the fs backend, as it's easier to inspect and interact with, and it offers a better insight in the internals of the storage layout. :)

Hmm, on a second look I see you did execute bootstrap, so maybe the issue is that there's a problem with loading the correct environment.

Please use the --env ENV flag on the ./bin/ctl command with ENV matching the environment you want to run on.

I tried that, and it didn't help (same error). According to ./bin/ctl --help, the dev environment is the default anyway, which is the same as in my .env file.

I then deleted my storage folder and updated the .env file to use the fs backend. The ./bin/ctl --env dev bootstrap and ./bin/ctl --env ap actor add admin command works fine, but adding the oauth client fails with the error Error: Invalid bucket chalet-fedbox.local.

Here's the entire command history:

chalet-admin@chalet:/var/www/fedbox/src$ cat .env
HOSTNAME=chalet-fedbox.local
LISTEN=localhost:4000
ENV=dev
STORAGE=fs
STORAGE_PATH=/var/www/fedbox/storage/
chalet-admin@chalet:/var/www/fedbox/src$ mkdir /var/www/fedbox/storage/
chalet-admin@chalet:/var/www/fedbox/src$ ./bin/ctl --env dev bootstrap
chalet-admin@chalet:/var/www/fedbox/src$ ./bin/ctl --env dev ap actor add admin
admin's pw:
pw again:
Added "Person" [admin]: http://chalet-fedbox.local/actors/5ea7fccf-a1b6-4e38-aa85-c7513f0edf8a
chalet-admin@chalet:/var/www/fedbox/src$ ./bin/ctl --env dev oauth client add --redirectUri=http://littr.local/auth/fedbox/callback
client's pw:
pw again:
Error: Invalid bucket chalet-fedbox.local

Interesting, I'll give it a look, the problem in this case might be the dash, but I'm not sure. I'll try to get back with an update sometime next week.

[edit]: I think I know. The OAuth2 storage where the client gets added to might be iffy, truth be told I don't think I have tested fedbox in quite a while with it being blank.

A manual work-around would be to install thunder, open the OAuth2 boltdb database (OAuth2 data always gets persisted to boltdb) and create the chalet-fedbox.local bucket manually.

I'll try that, thanks.

I changed the HOSTNAME to not contain a dash, and I still get the error Error: Invalid bucket test.local with the fs storage backend.

Yes, see my edited comment. Sorry for all the trouble. I see now that I don't have a very streamlined experience of bringing the project up. :D With your help it will be better soon.

OK, I fixed the problem with creating clients in an empty boltdb OAuth2 storage.

Relevant commits:
go-ap/auth/commit/2c426587
go-ap/fedbox/commit/c3516811c

Please give it a test