#Too few arguments to function ThrottlePasswordRecovery

54 messages ยท Page 1 of 1 (latest)

analog crag
#

Hello guys, i am having a problem with reseting the password on a multitenant project.
The error i am getting is:

Too few arguments to function Backpack\CRUD\app\Http\Middleware\ThrottlePasswordRecovery::buildException(), 2 passed in /Users/jordanchoeftimov/Desktop/Github repositories/markt/vendor/laravel/framework/src/Illuminate/Routing/Middleware/ThrottleRequests.php on line 54 and at least 3 expected

Does anyone have a clue on what might be the problem?

hardy knot
#

Hello @analog crag,

I do not know Backpack, and have never used it.

I have just done quick scan of the Backpack github repo, I see that you need to make sure in your config file the key password_recovery_throttle_access needs to have two values separated with a comma, as mentioned in the comment just above of the config key

Defaults to 3,10 - 3 times in 10 minutes.

e,g 'password_recovery_throttle_access => '3,10'

#

Could that be it ?

analog crag
#

I will try that right away.

#

I've been looking for a solution almost an hour and couldn't find one so i posted it here.

#

Will you be kind enough so you can send me the reference of that so i can look it up my self as well.

#

@hardy knot

hardy knot
analog crag
#

Yes, but that was not the case. The problem being is that for some reason in production the database is not seeded properly, while in local it seeds fine.

#

I think the problem is with multitenancy instead of backpack.

hardy knot
#

I wonder how a seeding issue could impact the middleware call.

Could you expand on your multitenancy environnement, are you using another package for that ?

analog crag
#
Tenancy for Laravel

Automatically turn any Laravel application multi-tenant โ€” no code changes needed. stancl/tenancy automatically switches database connections and all other things in the background, letting you leverage standard Laravel code into a full SaaS application. Most features out of all multi-tenancy packages. Single & multi-database tenancy.

#

This is what i am using for the multitenancy.

#

So the problem i think it might be is this.

#

For some reason, the reset password works on the older tenants.

#

But for every newly created tenant it does not work.

#

And also, i have a seeder that seeds the database.

#

With a admin user.

#

And i have set password and email address for that user.

#

But when a new tenant is created, the user is not recognized on login.

#

That's why i am suspecting that the seeding process might be the problem.

hardy knot
#

It's a great package, I also use it ๐Ÿ‘๐Ÿผ

hardy knot
#

And you try to reset the password, and it fails ?

analog crag
#

On the newly created tenants. yes.

#

On the older ones, it does work.

#

That is what is confusing to me.

#

And also, i did not change anything on the project for quite some time.

#

So i cannot wrap my head around the problem.

#

And most importantly, locally it works.

#

In production it does not.

hardy knot
#

The only thing I see how it could work for older tenants and not new ones. Is if you use the tenant config feature https://tenancyforlaravel.com/docs/v3/features/tenant-config. (But I don't think this would be it).

But because you are saying the main user didn't seed properly, this is what you should fix first before trying to fixe you middleware.

analog crag
#

And why would it work locally

#

and not in production?

hardy knot
#

Change your APP_ENV=local to APP_ENV=production and try again.

#

In your config/tenancy.php file, do you have the --force

    /**
     * Parameters used by the tenants:seed command.
     */
    'seeder_parameters' => [
        '--class' => 'TenantSeeder', // root seeder class
        '--force' => true,
    ],
analog crag
#

It is commented actually.

#

Is that the problem?

#

Btw, when i changed the APP_ENV=local to APP_ENV=production

#

it still worked.

#

and if i change it to --force, what will actually happen?

hardy knot
#

The --force tells Laravel to run the commands even in production.

But it depends how you seed data in your tenant, are you seeders for development testing or is it necessary for your tenant ?

analog crag
#

it is necessary

#

since without the admin user you cannot configure the tenant with your settings and plugins

#

this is the TenantSeeder code

#
public function run()
    {
        $this->call(RolesAndPermissionsSeeder::class);
        $this->call(LocalUserSeeder::class);
        $this->call(SettingsSeeder::class);
        $this->call(PluginSeeder::class);
        $this->call(PageSeeder::class);
    }
hardy knot
#

And are any of them called ?

analog crag
#

Sorry that took me so long to respond.

#

Your solution solved my problem.

#

Thanks a lot for your time and your patience with me.

#

--force => true solved the problem.

hardy knot
#

No worries at all.
I'm glad that fixed your problem ๐Ÿ‘๐Ÿผ

#

Also, there's a discord server for the tenancy package if you're interested