Sage 9 Production process

Hello, I am trying to get my theme to work on Kinsta.com. I cannot seem to figure out what I need to do.

I yarn build:production then uploaded my theme and its blank.

Ive been playing with the publicPath ("/[site].kinsta.com/wp-content/themes/[theme name]/") and then yarn build:production and uploading my dist folder but still nothing??

Any help?

Edit your wp-config.php file and set the debug setting to true.

Refresh the page and post the error message.

Cheers,
Paul

Fatal error: Uncaught ReflectionException: Class App\Controllers\App does not exist in /www/[sitename]_409/public/wp-content/themes/[theme_name]/vendor/soberwp/controller/src/Loader.php:74

that is what I am getting…

Have you copied the rest of the sage files to the production env?

You will need to copy:

app/
config/
dist/
resources/
vendor/

1 Like

Yup, all those are uploaded too. Its odd.

what is my publicPath in my config.json supposed to look like?

“publicPath”: “app/themes/sage”,

“publicPath”: “wp-content/themes/[my theme]”,

This error means that PHP can’t find your controllers (specifically, that soberwp/controller can’t load them). If you search for “Uncaught ReflectionException” in this forum you should see some people with the same issue.

Generally it means that there is a problem with autoloading: Something about your setup prevents Composer’s autoloader from finding your controller files. Make sure you’ve had composer generate an autoloader. Sometimes it also has to do with case sensitivity across operating systems.

Thanks, I am working on windows and kinsta is linux so I am seeing the case sensitivity thing. I renamed app to App and the fatal is gone but a new Error locating …/app/helpers.php for inclusion.

What is the best way to have composer add an auto loader?

“autoload”: {
“psr-4”: {
“App\”: “App/”
}
},

Composer autoloading is explained very well in the Composer documentation.

app/helpers.php is not autoloaded via Composer, it is loaded directly by Sage. If it can’t find it, then either the file is missing or your paths are messed up. The error should show you what file or function is trying to load the file, and where it’s looking for (and failing) to find it. Check all of those locations and make sure they’re correct.

1 Like

So yes. It was a case issue. my folder app/ needed to renamed App/ and then I needed to update functions.php $file = “…/App/{$file}.php”;

1 Like