Torann / laravel-geoip

Determine the geographical location of website visitors based on their IP addresses.
http://lyften.com/projects/laravel-geoip
BSD 2-Clause "Simplified" License
2.11k stars 372 forks source link

Won't show exception if cache driver is not supported #236

Open huzaifaarain opened 10 months ago

huzaifaarain commented 10 months ago

Instead of throwing an exception, the configuration file explicitly mentioned the unsupported drivers, the package should gracefully handle it instead of throwing an exception.

abbasmashaddy72 commented 9 months ago

I am using Dynamo_DB in AWS Lambda Trows same Exception Error:

This cache store does not support tagging.

This Below is the Stack Trace: Not Complete as Includes Confidential Info

BadMethodCallException:
This cache store does not support tagging.

  at /var/task/vendor/laravel/framework/src/Illuminate/Cache/Repository.php:507
  at Illuminate\Cache\Repository->tags(array('torann-geoip-location'))
     (/var/task/vendor/laravel/framework/src/Illuminate/Cache/CacheManager.php:429)
  at Illuminate\Cache\CacheManager->__call('tags', array(array('torann-geoip-location')))
     (/var/task/vendor/torann/geoip/src/Cache.php:32)
  at Torann\GeoIP\Cache->__construct(object(CacheManager), array('torann-geoip-location'), 30)
     (/var/task/vendor/torann/geoip/src/GeoIP.php:88)
  at Torann\GeoIP\GeoIP->__construct(array('log_failures' => true, 'include_currency' => true, 'service' => 'ipapi', 'services' => array('maxmind_database' => array('class' => 'Torann\\GeoIP\\Services\\MaxMindDatabase', 'database_path' => '/tmp/storage/app/geoip.mmdb', 'update_url' => 'https://download.maxmind.com/app/geoip_download?edition_id=GeoLite2-City&license_key=&suffix=tar.gz', 'locales' => array('en')), 'maxmind_api' => array('class' => 'Torann\\GeoIP\\Services\\MaxMindWebService', 'user_id' => null, 'license_key' => null, 'locales' => array('en')), 'ipapi' => array('class' => 'Torann\\GeoIP\\Services\\IPApi', 'secure' => true, 'key' => null, 'continent_path' => '/tmp/storage/app/continents.json', 'lang' => 'en'), 'ipgeolocation' => array('class' => 'Torann\\GeoIP\\Services\\IPGeoLocation', 'secure' => true, 'key' => null, 'continent_path' => '/tmp/storage/app/continents.json', 'lang' => 'en'), 'ipdata' => array('class' => 'Torann\\GeoIP\\Services\\IPData', 'key' => null, 'secure' => true), 'ipfinder' => array('class' => 'Torann\\GeoIP\\Services\\IPFinder', 'key' => null, 'secure' => true, 'locales' => array('en'))), 'cache' => 'all', 'cache_tags' => array('torann-geoip-location'), 'cache_expires' => 30, 'default_location' => array('ip' => '127.0.0.0', 'iso_code' => 'US', 'country' => 'United States', 'city' => 'New Haven', 'state' => 'CT', 'state_name' => 'Connecticut', 'postal_code' => '06510', 'lat' => 41.31, 'lon' => -72.92, 'timezone' => 'America/New_York', 'continent' => 'NA', 'default' => true, 'currency' => 'USD')), object(CacheManager))
     (/var/task/vendor/torann/geoip/src/GeoIPServiceProvider.php:37)
  at Torann\GeoIP\GeoIPServiceProvider->Torann\GeoIP\{closure}(object(Application), array())
     (/var/task/vendor/laravel/framework/src/Illuminate/Container/Container.php:908)
  at Illuminate\Container\Container->build(object(Closure))
     (/var/task/vendor/laravel/framework/src/Illuminate/Container/Container.php:795)
  at Illuminate\Container\Container->resolve('geoip', array(), true)
     (/var/task/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:957)
  at Illuminate\Foundation\Application->resolve('geoip', array())
     (/var/task/vendor/laravel/framework/src/Illuminate/Container/Container.php:731)
  at Illuminate\Container\Container->make('geoip', array())
     (/var/task/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:942)
  at Illuminate\Foundation\Application->make('geoip', array())
     (/var/task/vendor/laravel/framework/src/Illuminate/Foundation/helpers.php:120)
  at app('geoip')
     (/var/task/vendor/torann/geoip/src/helpers.php:14)
  at geoip()
abbasmashaddy72 commented 9 months ago

@huzaifaarain May I know What will happen Exactly in the background Just for My Knowledge

Will we get the IP of User If exception is not shown as it is not supporting the tag cache?

alies-dev commented 9 months ago

I experienced the issue and fixed in my fork: https://github.com/InteractionDesignFoundation/laravel-geoip/releases/tag/3.4.2