I just tried to deploy a fresh Laravel project running Statamic CMS. I got a weird build error:
In Request.php line 321: Symfony\Component\HttpFoundation\Request::create(): Argument #1 ($uri) must be of type string, null given, called in /var/www/html/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/SetRequestForConsole.php on line 31
At the end of the composer install step. According to a quick search this is usually caused by not having an APP_URL set in the ENV file. However I have it set in my fly.toml, here are all my “[env]” entries:
Ah. I would guess that (like secrets) those variables are only available to your app/vm at run-time. Not at build-time, which you mention. A subtle difference. So at that moment, your APP_URL would not be set, explaining the null error.
Since an APP_URL is not a secret, the simplest fix may be to just hard-code that into your Dockerfile. Then it must be available at build-time. Not sure if using ENV or ARG is better but e.g:
ENV APP_URL https://my-app-name.fly.dev
Can’t hurt to try. See what happens next time you build/deploy
As for why that’s not in the default Dockerfile, I would guess that shouldn’t (or at least didn’t used to) be needed for a default Laravel installation at build-time.
I’d guess (having not tried it) it could be due to the addition of Statamic ? As I recall the base guide is just for a hello-world style Laravel site.
And yep, setting it to anything would work as that error message is complaining it’s null. Setting it to a string, any string, would thus bypass that error.