owncloud-archive / maps

:globe_with_meridians: Maps app for ownCloud
GNU Affero General Public License v3.0
42 stars 20 forks source link

After adding Mapzen API Key table cannot be found #134

Open e-alfred opened 8 years ago

e-alfred commented 8 years ago

Hello,

after adding an Api key for Mapzen I am getting this error on Owncloud 8.2.3:

{"reqId":"Vvpign8AAQEAACo7KAcAAAAK","remoteAddr":"1.1.1.1","app":"index","message":"Exception: {\"Exception\":\"OCP\AppFramework\Db\MultipleObjectsReturnedException\",\"Message\":\"More than one result\",\"Code\":0,\"Trace\":\"#0 \/var\/www\/owncloud\/lib\/public\/appframework\/db\/mapper.php(346): OCP\AppFramework\Db\Mapper->findOneQuery('SELECT * FROM ...', Array, NULL, NULL)\\n#1 \\\/var\\\/www\\\/owncloud\\\/apps\\\/maps\\\/db\\\/apikeymapper.php(32): OCP\\\\AppFramework\\\\Db\\\\Mapper->findEntity('SELECT * FROM...', Array)\n#2 \/var\/www\/owncloud\/apps\/maps\/controller\/pagecontroller.php(65): OCA\Maps\Db\ApiKeyMapper->findByUser('alfred')\n#3 [internal function]: OCA\Maps\Controller\PageController->index()\n#4 \/var\/www\/owncloud\/lib\/private\/appframework\/http\/dispatcher.php(159): call_user_func_array(Array, Array)\n#5 \/var\/www\/owncloud\/lib\/private\/appframework\/http\/dispatcher.php(89): OC\AppFramework\Http\Dispatcher->executeController(Object(OCA\Maps\Controller\PageController), 'index')\n#6 \/var\/www\/owncloud\/lib\/private\/appframework\/app.php(108): OC\AppFramework\Http\Dispatcher->dispatch(Object(OCA\Maps\Controller\PageController), 'index')\n#7 \/var\/www\/owncloud\/lib\/private\/appframework\/routing\/routeactionhandler.php(45): OC\AppFramework\App::main('PageController', 'index', Object(OC\AppFramework\DependencyInjection\DIContainer), Array)\n#8 [internal function]: OC\AppFramework\routing\RouteActionHandler->__invoke(Array)\n#9 \/var\/www\/owncloud\/lib\/private\/route\/router.php(291): call_user_func(Object(OC\AppFramework\routing\RouteActionHandler), Array)\n#10 \/var\/www\/owncloud\/lib\/base.php(849): OC\Route\Router->match('\/apps\/maps\/')\n#11 \/var\/www\/owncloud\/index.php(39): OC::handleRequest()\n#12 {main}\",\"File\":\"\/var\/www\/owncloud\/lib\/public\/appframework\/db\/mapper.php\",\"Line\":290}","level":3,"time":"2016-03-29T13:09:55+02:00","method":"GET","url":"\/owncloud\/index.php\/apps\/maps\/"}

v1r0x commented 8 years ago

Sorry for the late answer. Looks like you have more than one key in your database. Could you try to delete one (or both) and try again?

v1r0x commented 8 years ago

Any news @e-alfred?

GetMike commented 8 years ago

Hi, same problem for me, when trying the maps-app ... after adding the mapzen api key, the maps-app did not work any longer: "Exception: {\"Exception\":\"OCP\AppFramework\Db\MultipleObjectsReturnedException\",\"Message\":\"More than one result\" I only added one key, which i generated just before with a new account. BTW: where/how can i find/delete this key in which database? :) You see, I'm no expert concerning apps in owncloud, just a user. Thanks, Mike

v1r0x commented 8 years ago

Sorry to hear that. To delete your key you have to start your sql from console (e.g. mysql -u <your username> -p -D <owncloud db-name>) and search for your keys using something like this SELECT * FROM oc_maps_apikeys WHERE user_id = '<your oc-username>'; and then delete all of them by ID (except the first). Do this by DELETE FROM oc_maps_apikeys WHERE id = <apikey-id>;

GetMike commented 8 years ago

Thanks, found it ... and realized, that I had configured sqlite instead of mysql :)

v1r0x commented 8 years ago

Do you know why there were two entries in the db? Maybe I should add an info that it has been added.

GetMike commented 8 years ago

Sorry for the late answer - no, I've got no idea why there where two entries in the db. Maybe it happened when saving the key? Or during my playing around with OC and its apps ...

BTW: I used the mapzen key for "Mapzen Search". This one will not work for navigation, right? Therefore I would need the key "Turn by Turn"? Do I have to add this second key in the settings of your app? How will this work? My oc-version: 9.0.1

v1r0x commented 8 years ago

Thanks for the answer. I'll check it on a new instance if the key is added twice.

I use the mapzen searc key too. Routing is always done using nominatim I think. The reason we added the mapzen key is that nominatim doesn't allow a dropdown list and suggestions as well.

GetMike commented 8 years ago

Hei, the POIs are shown the first time in my map - great :)

v1r0x commented 8 years ago

So this is fixed with the new branch?

GetMike commented 8 years ago

Hi, it's me again ... POIs (and contacts) worked for a short time last week, but now they are no longer shown in the maps. Address search (dropdown) also does not work in Firefox, but it works in Chrome. Updated OC to 9.0.2.

v1r0x commented 8 years ago

Please open another issue as long if this is not related to the api key issue. And please tell me if the api key error is fixed now?

e-alfred commented 8 years ago

@v1r0x I deleted the additional API keys and at least adding works with the 0.0.6 release. Where to get the new 0.1 branch?

I also get this error in the Chrome developer console while trying to search for a town:

https://search.mapzen.com/v1/search?api_key=search-64a65g3%20&text=town Failed to load resource: the server responded with a status of 403 (Forbidden)

v1r0x commented 8 years ago

You can check out this branch using git checkout remove-old-apikeys

It looks like you have some whitespaces in your key. Check out the branch and re-enter your key. I'll have a look at the mapzen doc, maybe there is a method to check if a provided key is valid