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

Error retrieving Currency Exchange Rate #1723

Closed
emansih opened this issue Sep 24, 2018 · 5 comments
Closed

Error retrieving Currency Exchange Rate #1723

emansih opened this issue Sep 24, 2018 · 5 comments
Labels
fixed Bugs that are fixed (in a coming release).

Comments

@emansih
Copy link
Contributor

emansih commented Sep 24, 2018

Bug description
I am running Firefly III version 4.7.6.2

When retrieving currency exchange rate without an API key, the following error is thrown

{
    "message": "Internal Firefly III Exception. See log files.",
    "exception": "Symfony\\Component\\Debug\\Exception\\FatalThrowableError"
}

Here is the relevant log

[2018-09-25 00:15:59] local.WARNING: No fixer.IO API key, will not do conversion.
[2018-09-25 00:15:59] local.ERROR: Exception is: {"class":"Symfony\\Component\\Debug\\Exception\\FatalThrowableError","errorMessage":"Call to a member function toAtomString() on null","time":"Tue, 25 Sep 2018 00:15:59 +0800","file":"\/var\/www\/firefly.xxx.com\/app\/Transformers\/CurrencyExchangeRateTransformer.php","line":94,"code":0,"version":"4.7.6.2","url":"https:\/\/firefly.xxx.com\/api\/v1\/cer","userAgent":"PostmanRuntime\/7.3.0","json":true}
[2018-09-25 00:15:59] local.ERROR: Call to a member function toAtomString() on null {"userId":1,"email":"danielquah148@yahoo.com","exception":"[object] (Symfony\\Component\\Debug\\Exception\\FatalThrowableError(code: 0): Call to a member function toAtomString() on null at /var/www/firefly.xxx.com/app/Transformers/CurrencyExchangeRateTransformer.php:94)
[stacktrace]
#0 /var/www/firefly.xxx.com/vendor/league/fractal/src/Scope.php(407): FireflyIII\\Transformers\\CurrencyExchangeRateTransformer->transform(Object(FireflyIII\\Models\\CurrencyExchangeRate))
#1 /var/www/firefly.xxx.com/vendor/league/fractal/src/Scope.php(346): League\\Fractal\\Scope->fireTransformer(Object(FireflyIII\\Transformers\\CurrencyExchangeRateTransformer), Object(FireflyIII\\Models\\CurrencyExchangeRate))
#2 /var/www/firefly.xxx.com/vendor/league/fractal/src/Scope.php(235): League\\Fractal\\Scope->executeResourceTransformers()
#3 /var/www/firefly.xxx.com/app/Api/V1/Controllers/CurrencyExchangeRateController.php(109): League\\Fractal\\Scope->toArray()
#4 [internal function]: FireflyIII\\Api\\V1\\Controllers\\CurrencyExchangeRateController->index(Object(Illuminate\\Http\\Request))
#5 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Controller.php(54): call_user_func_array(Array, Array)
#6 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/ControllerDispatcher.php(45): Illuminate\\Routing\\Controller->callAction('index', Array)
#7 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Route.php(212): Illuminate\\Routing\\ControllerDispatcher->dispatch(Object(Illuminate\\Routing\\Route), Object(FireflyIII\\Api\\V1\\Controllers\\CurrencyExchangeRateController), 'index')
#8 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Route.php(169): Illuminate\\Routing\\Route->runController()
#9 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(665): Illuminate\\Routing\\Route->run()
#10 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Routing\\Router->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#11 /var/www/firefly.xxx.com/app/Api/V1/Controllers/CurrencyExchangeRateController.php(60): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#12 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(133): FireflyIII\\Api\\V1\\Controllers\\CurrencyExchangeRateController->FireflyIII\\Api\\V1\\Controllers\\{closure}(Object(Illuminate\\Http\\Request), Object(Closure))
#13 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#14 /var/www/firefly.xxx.com/app/Http/Middleware/Binder.php(78): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#15 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): FireflyIII\\Http\\Middleware\\Binder->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#16 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#17 /var/www/firefly.xxx.com/app/Http/Middleware/Authenticate.php(73): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#18 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): FireflyIII\\Http\\Middleware\\Authenticate->handle(Object(Illuminate\\Http\\Request), Object(Closure), 'api')
#19 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#20 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#21 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(667): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#22 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(642): Illuminate\\Routing\\Router->runRouteWithinStack(Object(Illuminate\\Routing\\Route), Object(Illuminate\\Http\\Request))
#23 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(608): Illuminate\\Routing\\Router->runRoute(Object(Illuminate\\Http\\Request), Object(Illuminate\\Routing\\Route))
#24 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Router.php(597): Illuminate\\Routing\\Router->dispatchToRoute(Object(Illuminate\\Http\\Request))
#25 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(176): Illuminate\\Routing\\Router->dispatch(Object(Illuminate\\Http\\Request))
#26 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(30): Illuminate\\Foundation\\Http\\Kernel->Illuminate\\Foundation\\Http\\{closure}(Object(Illuminate\\Http\\Request))
#27 /var/www/firefly.xxx.com/vendor/fideloper/proxy/src/TrustProxies.php(57): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#28 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Fideloper\\Proxy\\TrustProxies->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#29 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#30 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#31 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#32 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#33 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/TransformsRequest.php(31): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#34 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\TransformsRequest->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#35 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#36 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/ValidatePostSize.php(27): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#37 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\ValidatePostSize->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#38 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#39 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Middleware/CheckForMaintenanceMode.php(62): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#40 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): Illuminate\\Foundation\\Http\\Middleware\\CheckForMaintenanceMode->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#41 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#42 /var/www/firefly.xxx.com/app/Http/Middleware/SecureHeaders.php(46): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#43 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(151): FireflyIII\\Http\\Middleware\\SecureHeaders->handle(Object(Illuminate\\Http\\Request), Object(Closure))
#44 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Routing/Pipeline.php(53): Illuminate\\Pipeline\\Pipeline->Illuminate\\Pipeline\\{closure}(Object(Illuminate\\Http\\Request))
#45 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(104): Illuminate\\Routing\\Pipeline->Illuminate\\Routing\\{closure}(Object(Illuminate\\Http\\Request))
#46 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(151): Illuminate\\Pipeline\\Pipeline->then(Object(Closure))
#47 /var/www/firefly.xxx.com/vendor/laravel/framework/src/Illuminate/Foundation/Http/Kernel.php(116): Illuminate\\Foundation\\Http\\Kernel->sendRequestThroughRouter(Object(Illuminate\\Http\\Request))
#48 /var/www/firefly.xxx.com/public/index.php(76): Illuminate\\Foundation\\Http\\Kernel->handle(Object(Illuminate\\Http\\Request))
#49 {main}
"}

Intended Output
The json response should get user to add a API key instead of throwing an exception

@JC5
Copy link
Member

JC5 commented Sep 25, 2018

Yep. Thanks for reporting!

@JC5
Copy link
Member

JC5 commented Sep 26, 2018

Not sure what the problem was, but I've pushed some code that should prevent this. I can't replicate this.

@JC5 JC5 added the fixed Bugs that are fixed (in a coming release). label Sep 26, 2018
@emansih
Copy link
Contributor Author

emansih commented Sep 26, 2018

I'm able to reproduced in the demo site.

curl -X GET 'https://demo.firefly-iii.org/api/v1/cer' -H 'Accept: application/json' -H 'Authorization: Bearer xxxx' 
{"message":"Internal Firefly III Exception. See log files.","exception":"Symfony\\Component\\Debug\\Exception\\FatalThrowableError"}  

JC5 added a commit that referenced this issue Sep 27, 2018
@JC5
Copy link
Member

JC5 commented Sep 27, 2018

I've pushed the updates and the demo site works for me. Could you verify?

@emansih
Copy link
Contributor Author

emansih commented Sep 27, 2018

Thanks, it works now.

@emansih emansih closed this as completed Sep 27, 2018
@lock lock bot locked as resolved and limited conversation to collaborators Jan 23, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
fixed Bugs that are fixed (in a coming release).
Projects
None yet
Development

No branches or pull requests

2 participants