geocoder in combination with openstreetmap fails with white page if the address that needs to be geocoded is not within openstreetmap. Openstreetmap is not as detailed as Google Maps and therefore some roads are not available. A white screen makes it pretty difficult for users to understand what is going on. An error page would be much better.
Error message from log:
Drupal\Core\Entity\EntityStorageException: Could not execute query "http://nominatim.openstreetmap.org/search?q=Salmintie%2CLahti%2C15460%2C...". in Drupal\Core\Entity\Sql\SqlContentEntityStorage->save() (line 783 of map/core/lib/Drupal/Core/Entity/Sql/SqlContentEntityStorage.php).
| Comment | File | Size | Author |
|---|---|---|---|
| #7 | geocoder-revert-to-generic-exception-3008232-7.patch | 1.46 KB | itamair |
Comments
Comment #2
Iain.Madder commentedGetting the same issue
When trying to save a venue content type which uses the geocoder module, the site throws an error of The website encountered an unexpected error. Please try again later. whenever trying to save a content change
Reverting down to 8.x-2.0-beta5 from 8.x-2.0-beta6 resolves the issue, allowing.
Looking at the logs, I can see that geocoder is trying to make calls to the google api over HTTP instead of HTTPS, resulting in google to return an access denied error of Requests to this API must be over SSL. Load the API with "https://" instead of "http://"
It seems like geocoder in beta6 is returning an invalid address to openstreetmap which it doesn't know what to do with, so it throws an unexpected error.
Comment #3
itamair commentedthanks @Nchase for reporting this. It sounds strange ... because (from a a quick look to it) any change from beta5 to beta6 should have affected the Openstreetmap Provider/Handler ... so as the others.
But I might be wrong, and I would need some more time to review this (that I don't have now).
Will try as soon as I can ...
In the meanwhile every new clue of what might cause this (possible/eventual) regression is welcome.
So as any other reason discover.
Comment #4
itamair commentedComment #5
itamair commentedAs a very useful and helpful approach everyone affected by this issue (and interested in urgent fix) might clone the project git repo:
re-head on the 2.x-beta5 and then step by step apply and check from there which commit (that brought to 2.x-beta6) introduces the report regression in Openstreetmap provider (if really any). So to help us to quickly focus and fix into dev & new release. Thanks!
Comment #6
Steven.Pescador commentedHi all!
I had a look and can see there was a commit changing the generic /Exception handler to PluginException, which is no longer catching the sqlquery exception being thrown if no results were found. So I reverted this in a little patch for this if you'd like to use it. :)
Comment #7
itamair commentedNice catch @Steven.Pescador (indeed, of the bug, besides the \Exception ...).
I made a more general patch, to throw a general \Exception both in the geocode and in the reverse geocoder methods,
that fixes all this related issue ...
But you @Steven.Pescador are granted anyway.
Committing into dev, will be part of the new module releases.
Comment #9
itamair commentedComment #11
itamair commentedComment #12
hussainwebGlad to hear this is fixed. I had filed the same issue earlier at #3005330: Node save fails if geolocation fails (due to an exception). My patch was only slightly different.
I understand if you can't or don't want to, but I'd appreciate a credit for fixing this issue and the patch, even though that never got reviewed or committed. I'll close the issue I created.
Thanks again,
Comment #13
itamair commentedah sorry @hussainweb ... but I didn't see your issue, and they were probably un-related ...
Thanks so much for what you did, but unfortunately I guess that just one user might be granted as author of a issue fix, if done with one commit (like this one).
Actually I worked on this too ... without being granted. But we know. The opensource community works like this: we mainly care of working solutions than every time granting ...
I am not the main maintainer of the Geocoder module, so sincerely I don't feel free to create a further fake commit just for granting you (although I think might be fair to do).
Let's see if the main maintainer steps in and feels to.
Cheeers ...
Comment #14
hussainweb@itamair, thanks for the reply. I see I should have been clearer.
I don't mean creating an additional/fake commit. I just meant assigning a credit for this issue itself. Drupal.org allows crediting users even after they are marked as fixed. The option is available in the 'Credit & committing' section at the bottom of this page. There are some more details and screenshots at this link: https://www.drupal.org/getting-involved/maintainer/grant-issue-credits.
Again, this is not really required but I would appreciate if you would do this (it takes probably 30 seconds in total). It also doesn't need any fake commits at all.
Lastly, I think the issue is definitely related, but the patch was slightly different. In fact, in a comment on that issue, I also described the fix that was done in this patch.
Comment #15
itamair commentedComment #16
itamair commentedah nice! thanks @hussainweb ... I didn't know it.
Cool I do now. I credited you on this ...
Comment #17
hussainwebThank you! I appreciate it very much.