Laravel App Deployment Issue on Digital Ocean App Platform via GitHub

20 views Asked by At

I have a Laravel app which is working fine locally but when deploying to App Platform via Github I keep getting this error:

[2024-03-11 00:57:02] │        PHP Warning:  require_once(/workspace/bootstrap/app.php): Failed to open stream: No such file or directory in /workspace/artisan on line 20
[2024-03-11 00:57:02] │        PHP Fatal error:  Uncaught Error: Failed opening required '/workspace/bootstrap/app.php' (include_path='.:') in /workspace/artisan:20
[2024-03-11 00:57:02] │        Stack trace:
[2024-03-11 00:57:02] │        #0 {main}
[2024-03-11 00:57:02] │          thrown in /workspace/artisan on line 20
[2024-03-11 00:57:02] │        Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 255
[2024-03-11 00:57:02] │  !     WARNING: A post-autoload-dump script terminated with an error
[2024-03-11 00:57:02] │ 
[2024-03-11 00:57:02] │  !     ERROR: Dependency installation failed!
[2024-03-11 00:57:02] │  !     
[2024-03-11 00:57:02] │  !     The 'composer install' process failed with an error. The cause
[2024-03-11 00:57:02] │  !     may be the download or installation of packages, or a pre- or
[2024-03-11 00:57:02] │  !     post-install hook (e.g. a 'post-install-cmd' item in 'scripts')
[2024-03-11 00:57:02] │  !     in your 'composer.json'.
[2024-03-11 00:57:02] │  !     
[2024-03-11 00:57:02] │  !     Typical error cases are out-of-date or missing parts of code,
[2024-03-11 00:57:02] │  !     timeouts when making external connections, or memory limits.
[2024-03-11 00:57:02] │  !     
[2024-03-11 00:57:02] │  !     Check the above error output closely to determine the cause of
[2024-03-11 00:57:02] │  !     the problem, ensure the code you're pushing is functioning
[2024-03-11 00:57:02] │  !     properly, and that all local changes are committed correctly.
[2024-03-11 00:57:02] │  !     
[2024-03-11 00:57:02] │  !     For more information on builds for PHP on Heroku, refer to
[2024-03-11 00:57:02] │  !     https://devcenter.heroku.com/articles/php-support
[2024-03-11 00:57:02] │  !     
[2024-03-11 00:57:02] │  !     REMINDER: the following warnings were emitted during the build;
[2024-03-11 00:57:02] │  !     check the details above, as they may be related to this error:
[2024-03-11 00:57:02] │  !     - A post-autoload-dump script terminated with an error
[2024-03-11 00:57:02] │ 
[2024-03-11 00:57:02] │ ERROR: failed to build: exit status 1

The line being referenced here is $app = require_once __DIR__.'/bootstrap/app.php';

I’ve tried changing the source_dir to ./, but it didn’t resolve the issue. The deployment log indicates that the workspace root is set to /workspace, which I believe might be causing the problem:

1 01:09:52] │  ✔ cloned repo to /workspace
[2024-03-11 01:09:52] ╰────────────────────────────────────────╼
[2024-03-11 01:09:52] 
[2024-03-11 01:09:52]  › applying source directory ./
[2024-03-11 01:09:52]  ✔ using workspace root /workspace

My Laravel app includes a built-in installer that resides at a sub-URL(domain.com/installer). Locally, when I run php artisan serve and access the direct URL it’s also broken until I navigate to the localhost:8080/installer subdomain.

I’d greatly appreciate any advice or insight on how to resolve this deployment issue. Thank you!

0

There are 0 answers