extiverse / bazaar

The extension marketplace for your Flarum forum.
https://discuss.flarum.org/d/5151
MIT License
59 stars 14 forks source link

Token field empty #135

Closed malago86 closed 4 years ago

malago86 commented 4 years ago

Steps to reproduce

  1. Just installed with composer and activated the extension
  2. The token field is empty (3. Also, it's not working with translations, I have a different default language and all the texts are shown as variable names.)

Expected behaviour

Token field filled with the corresponding token, I tried to reinstall the extension but nothing.

Actual behaviour

Token field is empty, can't install new extensions.

Configuration

Operating system: Ubuntu 18.04

Version of Bazaar: 0.4.0 Version of Flarum: beta.9 Other extensions: +------------------------------+---------------+--------+ | Flarum Extensions | | | +------------------------------+---------------+--------+ | ID | Version | Commit | +------------------------------+---------------+--------+ | flarum-approval | v0.1.0-beta.8 | | | flarum-bbcode | v0.1.0-beta.8 | | | flarum-emoji | v0.1.0-beta.8 | | | flarum-lang-english | v0.1.0-beta.9 | | | flarum-flags | v0.1.0-beta.9 | | | flarum-likes | v0.1.0-beta.9 | | | flarum-lock | v0.1.0-beta.9 | | | flarum-markdown | v0.1.0-beta.9 | | | flarum-mentions | v0.1.0-beta.9 | | | flarum-statistics | v0.1.0-beta.9 | | | flarum-sticky | v0.1.0-beta.9 | | | flarum-subscriptions | v0.1.0-beta.9 | | | flarum-suspend | v0.1.0-beta.9 | | | flarum-tags | v0.1.0-beta.9 | | | darkfoxdeveloper-spanish | v1.0.4 | | | v17development-seo | 1.0.1 | | | fof-formatting | 0.1.2 | | | fof-pages | 0.2.6 | | | fof-bbcode-details | 0.1.0 | | | clarkwinkelmann-emojionearea | 0.2.0 | | | extiverse-bazaar | 0.4.0 | | | flagrow-analytics | 0.8.0 | | +------------------------------+---------------+--------+

luceos commented 4 years ago

Sorry totally missed this, has this been resolved already?

malago86 commented 4 years ago

No, still empty!

Actually, I just made a fresh installation of Flarum from scratch in a different directory and database and only installed Bazaar. The token field is empty and I can't connect to the flagrow account (it only opens an about:blank page).

Let me know what information you need, I really want to use Bazaar.

xprilion commented 4 years ago

Same issue, token field empty!

malago86 commented 4 years ago

Sorry totally missed this, has this been resolved already?

Upgraded to beta 10 and still no token, I tried to reactivate the extension too, no luck :(

luceos commented 4 years ago

Looks like a bug with beta 10 then, I will take a look. Thanks.

luceos commented 4 years ago

This is odd, I just tested this locally and it works fine.. Do any of you see anything in the log file? Did you try flushing cache php flarum cache:clear?

malago86 commented 4 years ago

It can't be a beta 10 problem because it was already happening with beta 9. Maybe a php configuration?

You can see the response here too: https://www.diablonext.com/foros/api/bazaar/connect

I checked the log, there is a connection problem to bazaar: `[2019-09-23 15:25:37] production.ERROR: Exception: Connecting failed in /home/website/public_html/foros/vendor/extiverse/bazaar/src/Api/Controllers/ConnectController.php:35 Stack trace:

0 /home/website/public_html/foros/vendor/flarum/core/src/Http/RouteHandlerFactory.php(40): Extiverse\Bazaar\Api\Controllers\ConnectController->handle(Object(Zend\Diactoros\ServerRequest))

1 /home/website/public_html/foros/vendor/flarum/core/src/Http/Middleware/DispatchRoute.php(67): Flarum\Http\RouteHandlerFactory->Flarum\Http{closure}(Object(Zend\Diactoros\ServerRequest), Array)

2 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/Next.php(60): Flarum\Http\Middleware\DispatchRoute->process(Object(Zend\Diactoros\ServerRequest), Object(Closure))

3 /home/website/public_html/foros/vendor/flarum/core/src/Http/Middleware/SetLocale.php(52): Zend\Stratigility\Next->handle(Object(Zend\Diactoros\ServerRequest))

4 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/Next.php(60): Flarum\Http\Middleware\SetLocale->process(Object(Zend\Diactoros\ServerRequest), Object(Zend\Stratigility\Next))

5 /home/website/public_html/foros/vendor/flarum/core/src/Http/Middleware/CheckCsrfToken.php(25): Zend\Stratigility\Next->handle(Object(Zend\Diactoros\ServerRequest))

6 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/Next.php(60): Flarum\Http\Middleware\CheckCsrfToken->process(Object(Zend\Diactoros\ServerRequest), Object(Zend\Stratigility\Next))

7 /home/website/public_html/foros/vendor/flarum/core/src/Http/Middleware/AuthenticateWithHeader.php(57): Zend\Stratigility\Next->handle(Object(Zend\Diactoros\ServerRequest))

8 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/Next.php(60): Flarum\Http\Middleware\AuthenticateWithHeader->process(Object(Zend\Diactoros\ServerRequest), Object(Zend\Stratigility\Next))

9 /home/website/public_html/foros/vendor/flarum/core/src/Http/Middleware/AuthenticateWithSession.php(34): Zend\Stratigility\Next->handle(Object(Zend\Diactoros\ServerRequest))

10 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/Next.php(60): Flarum\Http\Middleware\AuthenticateWithSession->process(Object(Zend\Diactoros\ServerRequest), Object(Zend\Stratigility\Next))

11 /home/website/public_html/foros/vendor/flarum/core/src/Http/Middleware/RememberFromCookie.php(53): Zend\Stratigility\Next->handle(Object(Zend\Diactoros\ServerRequest))

12 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/Next.php(60): Flarum\Http\Middleware\RememberFromCookie->process(Object(Zend\Diactoros\ServerRequest), Object(Zend\Stratigility\Next))

13 /home/website/public_html/foros/vendor/flarum/core/src/Http/Middleware/StartSession.php(63): Zend\Stratigility\Next->handle(Object(Zend\Diactoros\ServerRequest))

14 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/Next.php(60): Flarum\Http\Middleware\StartSession->process(Object(Zend\Diactoros\ServerRequest), Object(Zend\Stratigility\Next))

15 /home/website/public_html/foros/vendor/flarum/core/src/Api/Middleware/FakeHttpMethods.php(31): Zend\Stratigility\Next->handle(Object(Zend\Diactoros\ServerRequest))

16 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/Next.php(60): Flarum\Api\Middleware\FakeHttpMethods->process(Object(Zend\Diactoros\ServerRequest), Object(Zend\Stratigility\Next))

17 /home/website/public_html/foros/vendor/flarum/core/src/Http/Middleware/ParseJsonBody.php(30): Zend\Stratigility\Next->handle(Object(Zend\Diactoros\ServerRequest))

18 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/Next.php(60): Flarum\Http\Middleware\ParseJsonBody->process(Object(Zend\Diactoros\ServerRequest), Object(Zend\Stratigility\Next))

19 /home/website/public_html/foros/vendor/flarum/core/src/Http/Middleware/HandleErrors.php(59): Zend\Stratigility\Next->handle(Object(Zend\Diactoros\ServerRequest))

20 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/Next.php(60): Flarum\Http\Middleware\HandleErrors->process(Object(Zend\Diactoros\ServerRequest), Object(Zend\Stratigility\Next))

21 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/MiddlewarePipe.php(83): Zend\Stratigility\Next->handle(Object(Zend\Diactoros\ServerRequest))

22 /home/website/public_html/foros/vendor/middlewares/request-handler/src/RequestHandler.php(84): Zend\Stratigility\MiddlewarePipe->process(Object(Zend\Diactoros\ServerRequest), Object(Zend\Stratigility\Next))

23 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/Next.php(60): Middlewares\RequestHandler->process(Object(Zend\Diactoros\ServerRequest), Object(Zend\Stratigility\Next))

24 /home/website/public_html/foros/vendor/middlewares/base-path-router/src/BasePathRouter.php(97): Zend\Stratigility\Next->handle(Object(Zend\Diactoros\ServerRequest))

25 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/Next.php(60): Middlewares\BasePathRouter->process(Object(Zend\Diactoros\ServerRequest), Object(Zend\Stratigility\Next))

26 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/Middleware/OriginalMessages.php(41): Zend\Stratigility\Next->handle(Object(Zend\Diactoros\ServerRequest))

27 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/Next.php(60): Zend\Stratigility\Middleware\OriginalMessages->process(Object(Zend\Diactoros\ServerRequest), Object(Zend\Stratigility\Next))

28 /home/website/public_html/foros/vendor/middlewares/base-path/src/BasePath.php(53): Zend\Stratigility\Next->handle(Object(Zend\Diactoros\ServerRequest))

29 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/Next.php(60): Middlewares\BasePath->process(Object(Zend\Diactoros\ServerRequest), Object(Zend\Stratigility\Next))

30 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/MiddlewarePipe.php(83): Zend\Stratigility\Next->handle(Object(Zend\Diactoros\ServerRequest))

31 /home/website/public_html/foros/vendor/zendframework/zend-stratigility/src/MiddlewarePipe.php(72): Zend\Stratigility\MiddlewarePipe->process(Object(Zend\Diactoros\ServerRequest), Object(Zend\Stratigility\EmptyPipelineHandler))

32 /home/website/public_html/foros/vendor/zendframework/zend-httphandlerrunner/src/RequestHandlerRunner.php(95): Zend\Stratigility\MiddlewarePipe->handle(Object(Zend\Diactoros\ServerRequest))

33 /home/website/public_html/foros/vendor/flarum/core/src/Http/Server.php(46): Zend\HttpHandlerRunner\RequestHandlerRunner->run()

34 /home/website/public_html/foros/index.php(22): Flarum\Http\Server->listen()

35 {main}`

kevinpetit commented 4 years ago

I have the same issue, with the same errors.

luceos commented 4 years ago

Me too doesn't help. Post your flarum info output and server information please.

kevinpetit commented 4 years ago

spellborn_forum@alesia:~/public_html_flarum$ ./flarum info Flarum core 0.1.0-beta.10 PHP version: 7.3.9-1+ubuntu18.04.1+deb.sury.org+1 Loaded extensions: Core, date, libxml, openssl, pcre, zlib, filter, hash, pcntl, Reflection, SPL, sodium, session, standard, mysqlnd, PDO, xml, apcu, bcmath, calendar, ctype, curl, dom, mbstring, fileinfo, ftp, gd, gettext, gmp, iconv, igbinary, intl, json, ldap, exif, msgpack, mysqli, odbc, pdo_mysql, PDO_ODBC, apc, posix, readline, shmop, SimpleXML, sockets, sysvmsg, sysvsem, sysvshm, tidy, tokenizer, wddx, xmlreader, xmlwriter, xsl, zip, Phar, memcached, Zend OPcache +----------------------+----------------+--------+ | Flarum Extensions | | | +----------------------+----------------+--------+ | ID | Version | Commit | +----------------------+----------------+--------+ | flarum-approval | v0.1.0-beta.8 | | | flarum-bbcode | v0.1.0-beta.8 | | | flarum-emoji | v0.1.0-beta.10 | | | flarum-lang-english | v0.1.0-beta.10 | | | flarum-flags | v0.1.0-beta.9 | | | flarum-likes | v0.1.0-beta.9 | | | flarum-lock | v0.1.0-beta.9 | | | flarum-markdown | v0.1.0-beta.10 | | | flarum-mentions | v0.1.0-beta.10 | | | flarum-statistics | v0.1.0-beta.9 | | | flarum-sticky | v0.1.0-beta.9 | | | flarum-subscriptions | v0.1.0-beta.9 | | | flarum-suspend | v0.1.0-beta.9 | | | flarum-tags | v0.1.0-beta.10 | | | extiverse-bazaar | 0.4.0 | | +----------------------+----------------+--------+ Base URL: https://forum.spellborn.org Installation path: /srv/www/forum.spellborn.org/public_html_flarum Debug mode: off

Runs on Ubuntu 18.04, Nginx 1.14.0. PHP runs in it's own PHP-FPM pool, every file is owned by the user of the site.

malago86 commented 4 years ago

Still waiting for an answer, the problem seems to be happening to other people too: no token, empty page when trying to connect to flagrow, my IP is static, DNS are working, bazaar page does show extensions even with an empty token.

luceos commented 4 years ago

Can you also post php and database version. Also check whether the settings table has a value for the key named flagrow.bazaar.api_token.

malago86 commented 4 years ago

PHP: 7.2.22-1+ubuntu18.04.1+deb.sury.org+1 MYSQL: 5.7.27-0ubuntu0.18.04.1

The settings table only has one key with bazaar in its name: flagrow.bazaar.connected | 0

I hope that helps!

luceos commented 4 years ago

The exception shown isn't very explanatory, I think in order to solve this for you and many others it might be wise to give better feedback. I'll whip up a solution coming week.

clarkwinkelmann commented 4 years ago

It looks like the extension checks if flagrow-bazaar is enabled, even in the new extiverse-bazaar. Looks like it could be a reason for this.

https://github.com/extiverse/bazaar/blob/71c9fe35ccfdc77e1c740945d63a33799c3ac9b1/src/Listeners/BazaarEnabled.php#L65

I don't even know why there is a check for extension enabled ? That code should only run if the extension is enabled anyway.

luceos commented 4 years ago

@clarkwinkelmann oh 🤦‍♂ great find!

luceos commented 4 years ago

@malago86 @xprilion @kevinpetit please upgrade to 0.4.1, let me know when this issue can be closed.

malago86 commented 4 years ago

Hi @luceos, the token is now showing up!

However, I am still having problems installing extensions from Bazaar, it says that there was an error and I can't see any update in the flarum logs. I thought it was related to the absence of token but it looks like there is something else that is avoiding extensions to be installed.

Also, if I click on connect to flagrow it gives me a blank page too.

I tried reenabling the extension but I get the same results.

TLDR: Token is showing up but Bazaar is still unusable.

luceos commented 4 years ago

@malago86 can you check History in Bazaar. In addition the processes might time out, you could set up cron processing, instructions for that are in the settings of Bazaar.

Please if the issue persists, create a new issue as this is not related.

Closing this as the token problem is fixed.