Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Feedme to populate data in simplemap throws error #338

Closed
mufi-siebird opened this issue Apr 2, 2022 · 6 comments · Fixed by #387
Closed

Running Feedme to populate data in simplemap throws error #338

mufi-siebird opened this issue Apr 2, 2022 · 6 comments · Fixed by #387
Labels

Comments

@mufi-siebird
Copy link

Description

I am using Feedme plugin to automatically pull data to entry through atlas API. I have address ready. It throws error when map try to generate lat/lng. error is: Please configure UrlManager::hostInfo correctly as you are running a console application. - UrlManager.php: 648

I debug the error and found that I am on console application when queue is running from feedme. that makes this code invalid.
(ether/simplemap/src/services/GeoService.php) Line Number: 774.
image

Error from queue is, it needs instance of \yii\web\Request and it gets instance of \craft\console\Request.

Steps to reproduce

  1. Install Feedme plugin.
  2. add any address JSON and pull throgh feedme. (make sure lat/lng are not set.)
  3. Run feed me to add that data to entry.

Solution

it works If I change this portion:

$data = (string) static::_client()->get($url, [
    'headers' => [
        'referer' => Craft::$app->urlManager->getHostInfo()
    ]
])->getBody();

to this:

$data = (string) static::_client()->get($url, [
    'headers' => [
        'referer' => Craft::getAlias('@web')
    ]
])->getBody();

Additional info

  • Craft version: 3.7.37
  • Maps version: 3.9.3
  • PHP version: 7.4.20
  • Database driver & version: MySQL 5.7.37
  • Feedme version: 4.4.2
@tombo118
Copy link

Does changing to: 'referer' => Craft::getAlias('@web') work for both feed-me operations and the front end or do you need to make the change just for doing the feed-me and then revert to have the front end working correctly ?

@mufi-siebird
Copy link
Author

It works on both frontend and feed me (queues).

@mufi-siebird
Copy link
Author

mufi-siebird commented Jun 21, 2022

I would do something like this:

$data = (string) static::_client()->get($url, [
    'headers' => [
        'referer' => Craft::$app->getRequest()->getIsConsoleRequest() ? Craft::getAlias('@web') : Craft::$app->urlManager->getHostInfo()
    ]
])->getBody();

@tombo118
Copy link

Thank you for the speedy reply!

@Tam Tam added the Craft 3 label Jul 11, 2022
@mufi-siebird
Copy link
Author

@tombo118 Just changed above code a bit to be more accurate. Do we have any updates or ETA on when it can get sorted?

@maxdmyers
Copy link
Contributor

@mufi-siebird I opened a PR for this issue if you could +1 it for me I'd appreciate it.

@Tam Tam closed this as completed in 5de1d9a Apr 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants