Bug Invalid Exchange Rate API Response

Status
Not open for further replies.

EasyEasy

Customer
We had a server error message this morning. See below:


  • Exception: Invalid Exchange Rate API Response
  • src/addons/DBTech/Donate/Model/Currency.php:297

  • Generated by: Unknown account
  • Jul 22, 2018 at 1:03 AM

Stack trace

#0 src/addons/DBTech/Donate/Model/Currency.php(340): DBTech\Donate\Model\Currency->getExchangeRates()
#1 src/addons/DBTech/Donate/XF/Cron/Donate.php(9): DBTech\Donate\Model\Currency->setExchangeRates()
#2 [internal function]: DBTech\Donate\XF\Cron\Donate::setExchangeRates(Object(XF\Entity\CronEntry))
#3 src/XF/Job/Cron.php(35): call_user_func(Array, Object(XF\Entity\CronEntry))
#4 src/XF/Job/Manager.php(241): XF\Job\Cron->run(7.9999990463257)
#5 src/XF/Job/Manager.php(187): XF\Job\Manager->runJobInternal(Array, 7.9999990463257)
#6 src/XF/Job/Manager.php(76): XF\Job\Manager->runJobEntry(Array, 7.9999990463257)
#7 job.php(15): XF\Job\Manager->runQueue(false, 8)
#8 {main}




Request state



array(4) {
["url"] => string(18) "/community/job.php"
["referrer"] => string(47) "http://****************/community/index.php"
["_GET"] => array(0) {
}
["_POST"] => array(0) {
}
}
 
This is not an issue I am able to replicate, so it's likely the API simply had a temporary outage.
 
Can you trigger it 100% of the time if you manually run the exchange rate cron job for Donate?
 
Can you open up src/addons/DBTech/Donate/Model/Currency.php and look for the API endpoint URL in that file, and let me know what it is?
 
I think this is what you are after.

Code:
if (function_exists('curl_init') AND $ch = curl_init())
            {
                // We have cURL functions
                curl_setopt($ch, CURLOPT_URL, 'https://exchangeratesapi.io/api/latest?base=' . $primaryCurrency['currencyid']);
 
https://exchangeratesapi.io/api/latest?base=USD works fine for me, do you use a different base currency?
 
Interesting... Looking at the code, that shouldn't cause this exception to be thrown.

In either case, I do have improvements coming in the 3.1 version whenever that is finished, but in the meantime, feel free to just disable the cron job. It isn't needed when you have only 1 active currency.
 
Interesting... Looking at the code, that shouldn't cause this exception to be thrown.

In either case, I do have improvements coming in the 3.1 version whenever that is finished, but in the meantime, feel free to just disable the cron job. It isn't needed when you have only 1 active currency.

Sorry to ask this. Your url is https://exchangeratesapi.io/api/latest?base=USD

yet mine in my file is https://exchangeratesapi.io/api/latest?base=

Should that not have GBP in the url? Sorry if its a dumb question.
 
No, it shouldn't. As you can see in the file, it has a variable name after the URL, so it inserts your base currency into the URL before sending it off.
 
Hello @EasyEasy,

We hope your ticket regarding DragonByte Donate has been addressed to your satisfaction. This ticket has now been closed.

If your ticket has not been resolved, you can reply to this thread at any point in the next 7 days in order to reopen the ticket, afterwards this thread will be closed.

Please do not reply to this thread if your ticket has been resolved.

Thank you.


- DragonByte Technologies, Ltd.
 
Status
Not open for further replies.

DragonByte Donate

XenForo 1.5.3+ XenForo 2.0.x XenForo 2.1.x XenForo 2.2.x XenForo 2.3.x
Seller
DragonByte Technologies
Release date
Last update
Total downloads
1,910
Customer rating
5.00 star(s) 1 ratings
Back
Top