Just found following info in the docs in https://laravel.com/docs/9.x/configuration#configuration-caching :
"If you execute the config:cache command during your deployment process, you should be sure that you are only calling the env function from within your configuration files. Once the configuration has been cached, the .env file will not be loaded; therefore, the env function will only return external, system level environment variables."
As I'm sending the sms from the controller fetching the api keys from the env-file, I suppose this is the reason for the error. Any ideas on how to get around this? Of course I could hard code the api-keys in the controller or in a dedicated service, but is there also a more elegant solution? Thx.