#Updating a Laravel app with Stancl breaks the application

1 messages · Page 1 of 1 (latest)

soft yacht
#

After updating the app(laravel 12 to laravel 12.*) (composer update), the application breaks; the routes (tenants) stop working. In short, it stops working. I've already tried a fresh installation of Laravel, and the routes work again.

smoky geode
#

How did you update the application. Sometimes a quick rebuild is the fastest and cleanest option. Transferring controllers and routes and making a few tweaks where necessary

soft yacht
#

just "composer update" and everything went to hell, literally

smoky geode
soft yacht
#

I installed the API and it indicated that certain packages needed updating, and to update I ran "composer update" and after that nothing worked, the app is made from laravel 12.

smoky geode
#

Can you do “composer run dev” paste the error you get here. Let me see

soft yacht
#

error: Package "dev" listed for update is not locked.
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

Problem 1
- maatwebsite/excel is locked to version 3.1.67 and an update of this package was not requested.
- maatwebsite/excel 3.1.67 requires phpoffice/phpspreadsheet ^1.30.0 -> satisfiable by phpoffice/phpspreadsheet[1.30.1].
- phpoffice/phpspreadsheet 1.30.1 requires php >=7.4.0 <8.5.0 -> your php version (8.5.0) does not satisfy that requirement.

smoky geode
#

You might want delete composer.lock.json if it exists and package.lock.json if it is present. Then do npm install. Then composer install. Intend for your application to get the latest version of php spreadsheet which might be compatible with php 8.5

#

Do these steps and tell me the results you get

soft yacht
#

It doesn't work; in fact, even using version 12.44 breaks the URLs

coral trellis
smoky geode
lavish fulcrum
# coral trellis Is your app using php 8.5 in production? If not you can simply tell composer to ...

Beware with options like those, as it can lead to bugs (seen it happen). The option is rather destructive as there's no longer a version check, including for packages. You're enforcing the PHP version and it doesn't matter which version is actually used. We've had that once, bumped versions (so we thought) including the platform option, CI went fine and when we deployed everything broke down. Turned out there were a few things we hadn't changed, mostly the CI. It was partially a QA issue too, but it's easier for those things to slip through that way

soft yacht
#

I think the problem is in this part:

"Route::middleware([
'web',
InitializeTenancyByDomain::class,
PreventAccessFromCentralDomains::class,
])->group(function () {
Route::get('/', function () {

return view('tenants.welcome');

});

require DIR.'/auth.php';
});
" because when I do "http://tenant.localhost:8080/" it reaches the established welcome page, but the login and register URLs point to the central domain, "InitializeTenancyByDomain::class" isn't initialized, and "require DIR.'/auth.php';" isn't working either

soft yacht
smoky geode
#

Okay

#

I would look at it

soft yacht
#

in the main branch all is ok , but in tenant-user the links , url they are broken,

lavish fulcrum
#

You have these routes on your tenants and on your central domains, so you're defining the same routes twice. Then if they'd also use the same name, then it's a "first come first serve" situation (or last, idk exactly), point is, there's just one of those named routes that would work.

#

So it's probably not an upgrade that caused this, more likely a code change.

soft yacht
#

No, what happens is that the main branch works since everything indicated on the stancl/tenancy page is done but the register-tenant branch is only the update to access the welcome.php but from the tenant

lavish fulcrum
#

Not sure what you mean, but those routes don't make sense and do explain the issue you're facing.

soft yacht
#

The truth is, this doesn't look good at all. Wouldn't it be better to create a tenant from scratch?

lavish fulcrum
#

Did you even attempt to debug? Like, what I've mentioned?
Because that perfectly describes the issue you're facing; The login route is registered multiple times, so it exists at multiple places.

soft yacht
#

In the image you publish, they are the two branches that I published,

  • In the branch on your left it works without applying tenant routes as they are on the right side of the image