Problem/Motivation
I would like to allow users to enter an Address using the Address module and have those geocoded and stored by Geofield. I'm trying out the geocoder-php/free-geoip-provider
Steps to reproduce
- Enable Address, Geocoder, and Geofield, setting FreeGeoIp as the only active provider.
- Enable Geocoder_Address
- Create an address field on a content type - options for geocoding appear
- Create a geofield field on the content type - no options, as expected
- Enable geocoder_geofield
- Revisit the geofield settings, or create a new new one - no geocoding options (I expected options to set this to store geocodes.)
drush cr- Revisit either the address field or geofield settings pages - fatal error: "Drupal\Component\Plugin\Exception\PluginNotFoundException: The "freegeoip" plugin does not exist. Valid plugin IDs for Drupal\geocoder\ProviderPluginManager are: random, file, kmlfile, geojsonfile, gpxfile in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of .../core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php)."
It appears that clearing the cache has made the system forgets that the freegeoip plugin exists and has defaulted back to the out-of-the-box plugins.
Disabling geocoder_geofield recovers functionality
Additional Information
I discovered that geocoder-php/free-geoip-provider doesn't work for my purposes, so decided to swap it out for geocoder-php/google-maps-provider.
- Disable all Geocoder-related modules stepwise, up to and including Geocoder itself, so that the new provider could be installed.(It is ludicrous that this is necessary in order to add or change providers.)
composer require geocoder-php/google-maps-provider.- Re-enable Geocoder
- Activate GoogleMaps Provider
- Re-enable Geocoder Field & Geocoder Geofield: The existing geocode field now shows options for storing geocodes from another field, but the Address field isn't one of them, presumably because Geocoder_Address isn't enabled yet.
- Enable Geocoder_Address: The existing Address field's edit page does not show options for geocoding. Attempting to visit the existing Geofield's edit page, or the edit page for the GoogleMaps Provider, kills the site with watchdog logging Drupal\Component\Plugin\Exception\PluginNotFoundException: The "googlemaps" plugin does not exist. Valid plugin IDs for Drupal\geocoder\ProviderPluginManager are: random, file, kmlfile, geojsonfile, gpxfile in Drupal\Core\Plugin\DefaultPluginManager->doGetDefinition() (line 53 of .../core/lib/Drupal/Component/Plugin/Discovery/DiscoveryTrait.php).
- Disabling Geocoder_Address recovers access to Geofield's and GoogleMaps' edit pages
- Reversing the order of enabling of the Geocoder_Address and Geocoder Geofield modules behaves the same way.
Proposed resolution
Clearing cache should not break basic functionality, and/or enabling both Geocoder_Address and Geocoder_Geofield shouldn't break it.
Remaining tasks
User interface changes
API changes
Data model changes
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | Screenshot 2021-03-31 at 20.42.52.png | 265.02 KB | itamair |
Comments
Comment #2
msypes commentedComment #3
msypes commentedComment #4
itamair commented@msypes thanks for reporting your issue ...
But I cannot really replicate your issue. All looks working fine, with geocoder-php/free-geoip-provider and Geocoder_Geofield and all the other modules you mention. (@see my screenshots).
Did you forget to composer re-require the geocoder-php/free-geoip-provider library?
composer require geocoder-php/free-geoip-providerYou should better inspect and investigate/debug your case, and eventually prove (post evidence) of the application error log.
This should be proved (from you) to be a real bug (and not your personal issue in your dev environment)
Comment #5
itamair commentedMay be I am wrong, but it indeed seems to me that you are not using at all the proper way to composer require new geocoder providers libraries according to the new 3.x Geocoder branch (may be you just upgraded from the 2.x branch?). Be sure to have read and understood the relevant instructions in the Readme.md file ... and may be go through this support issue: https://www.drupal.org/project/geocoder/issues/3128165
Comment #6
msypes commentedComment #7
itamair commentedComment #8
msypes commentedThis is not an upgrade from a previous version of Geocoder. I have never used it before. This is a fresh install of v3.17 in a new vanilla D9 site.
I used composer to require all the necessary modules and each of the provider libraries prior to enabling any modules. The rest of the steps I have clearly outlined step-by-step. I do not see any difference in the ordering of my steps from the README file. Please tell me what it is about those steps that indicate to you that I'm "not using at all the proper way to composer require new geocoder providers libraries according to the new 3.x Geocoder branch."
Comment #9
itamair commentedSimply from its readme.md file: https://git.drupalcode.org/project/geocoder/-/blob/8.x-3.x/README.md
Comment #10
msypes commentedThat is exactly what I did, as noted in my post. I've tried both FreeGeoIP and GoogleMaps providers, requiring them via composer before enabling Geocoder. If both Geocoder_Address and Geocoder_Geofield are subsequently enabled, regardless of provider, Geocoder partially forgets that the provider plugin exists. Disabling either Geocoder_Address or Geocoder_Geofield recovers the plugin discovery process.
Comment #11
msypes commentedFor further information, this is what I've found in my debugging efforts when trying to edit the "GoogleMaps" provider on the configuration page:
I don't know exactly how the system should work, but it seems to me that either Geocoder isn't properly caching "googlemaps" (or whatever other provider has been required by composer and installed) or it shouldn't be looking strictly for cached definitions, but for all available definitions. My gut tells me it's the former.
Comment #12
itamair commentedThanks for you efforts, and investigations.
But, personally in this cases, I really ask myself what I am doing wrong ... when I hit so fundamentals issues, that nobody else seems reporting, besides me.
Did you find any similar issue or report to your one?
Because the Geocoder 3.x branch shows almost 6k official adoptions, and it is quite a lot ... Don’t you think is weird that nobody else is reporting a so basic first installation and use issue???
I really suggest to keep debugging, with the first intent to find what is not working for you.
And I am quite confident that you will end up solving this, by yourself, without any fix to the actual module.
But also I am opening credit to this issue of you and changing it from bug to support issue and reopening as active ...
Let’s see if somebody else steps in here and subscribe & report your same issue (that hence could point to something more general and objective).
Comment #13
itamair commentedComment #14
itamair commentedI further check this issue (not issue ... ),
by exactly replicating once again a clean Geocoder 3.x requirement and activation, only with the geocoder-php/free-geoip-provider requirement.
My actual setup:
PHP 7.3
Composer version 1.9.3
Drupal 9.03
Drush 10.3.4
Note: Drupal 9 should have been firstly required and installed through/with Composer (of course!)
Note2: Remove any previous Geocoder presence (may be 2.x version) with the following 2 commands:
composer remove drupal/geocodercomposer remove willdurand/geocoder(the last one shouldn't be needed as already comprised in the first one, but just to make 100% sure ... )
These following are the command I run (relevant to this issue) to require and install all the Geocoder 3.x module & submodules with just the geocoder-php/free-geoip-provider (besides the ones already embedded in the module):
composer require drupal/addresscomposer require drupal/geocodercomposer require geocoder-php/free-geoip-providerdrush en address geocoder geocoder_field geocoder_geofield geocoder_address -y... and all goes well, super charm, and I end up with a Geocoder module enabled and the capability to select and generate a free-geoip-provider (@see screenshot).
I am closing this again as I really cannot reproduce your issues, after all the time I already spent on this.
Reopen, or rather open a new more aware and focused issue if you find out that different (and specific) PHP or Composer version could be the cause of a clear issue of you, and properly document it.
We should report issues here but (very) hopefully also evidences and info on how to solve them ...
Comment #15
itamair commentedComment #16
msypes commentedThank you for your time.
(I have been asking myself what I'm doing wrong, but keep coming up empty, as all I'm doing is following the provided directions in the README. That's why I came here. In the hopes that someone else might notice what I'm doing wrong.)
The only differences I see in my set up are php 7.4, composer 1.10, drush 10.4, and Drupal 9.1.4
If/When I find what has caused this issue for me, I will report it.
Comment #17
itamair commented@mspyes probably this patch: https://www.drupal.org/project/geocoder/issues/3206916#comment-14049804
and new 8.x-3.19 release is gonna solve your issues ...
Comment #18
itamair commentedComment #19
msypes commentedYes, updating to 3.19 did correct the issue (not issue ... ).
Thanks again.