Hands up if seemingly half the time you spend at the computer, you’re fighting weird errors, instead of writing code.
Yeah, me too.
Whilst updating the front end of CodeReviewVideos, a Symfony 4 website, I encountered the following issue:
Executing script cache:clear [KO] [KO] Script cache:clear returned with error code 1 !! !! In BaseNode.php line 427: !! !! Invalid configuration for path "eight_points_guzzle.clients.crv_api.base_ur !! l": base_url can be: string !! !! !! In ExprBuilder.php line 189: !! !! base_url can be: string !! !! !! Script @auto-scripts was called via post-update-cmd
Strangely, the base_url parameter is a string, afaik:
eight_points_guzzle: clients: crv_api: base_url: '%env(CRV_API_BASE_URL)%'
And following that back to the .env file:
CRV_API_BASE_URL=https://api.codereviewvideos.com
So… what gives?
Well, I found by using a raw string, e.g.:
eight_points_guzzle: clients: crv_api: base_url: 'https://api.codereviewvideos.com'
That yeah, things worked as expected.
And I found that by checking the value of the environment variable inside the running Docker container, that also, yeah, I could see that it was seemingly set:
www-data@c3037e210ca4:~/www.codereviewvideos.com$ echo $CRV_API_BASE_URL https://api.codereviewvideos.com
My Solution
My solution was to force the use of the string environment variable processor:
eight_points_guzzle: clients: crv_api: base_url: '%env(string:CRV_API_BASE_URL)%'
And all is right once again in the world.
I wish I understood why that was happening, but I haven’t currently got the time to investigate that further. If you know the root cause, please do share. I’m very curious.
Thanks for this man! I was suspecting that this will be the case, but you confirmed this for me 🙂