Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

jrmypttrsn's avatar

Missing required parameters error in production but works locally

This is a strange one I've been fighting for the last 12ish hours. On my production app I'm getting the following error:

Missing required parameters for [Route: tasks.update] [URI: tasks/{task}]. (View: /home/forge/DOMAIN/resources/views/tasks/index.blade.php) 

My form action:

<form method="POST" action="{{ route('tasks.update', ['task' => $task->task_id]) }}">

My controller method:

 public function update(Task $task, Request $request)
    {
        if ($request->priority_score != $task->job->priority)
        {
            $task->job()->update([
                'priority' => $request->priority_score
            ]);

            return back()->with('success', 'Priority score successfully updated!');
        }

        $task->update($request->all());

        return back()->with('success', 'Task successfully updated!');
    }

And my routes/web.php

Route::post('/tasks/{task_id}', 'TaskController@update')->name('tasks.update');
Route::resource('tasks', 'TaskController');

I moved the update method to its own route in the hopes that might help the production issue, since it also works locally, but it did not.

I've cleared caches, run dump-autoload, all to no avail.

Thoughts?

Cross-posted on SO.

0 likes
7 replies
artcore's avatar

Can you try without an array in the route()

route('tasks.update', $task->task_id) 

I think I had something similar after upgrading to 7

helvetta's avatar

When loading the update page inspect the action value for your form to verify a task is being loaded and the value is what you expect. You may have a task on your local database but not on your production database.

jlrdw's avatar
jlrdw
Best Answer
Level 75

See what your browser developer tools is showing. That is strange. Unless there there is a case issue. Linux being case sensitive.

1 like
jrmypttrsn's avatar

@artcore This started last night when a user reported the page wasn't loading after I pushed my upgrade to 7 (after testing it worked locally). I rolled back so that the app could function properly while I troubleshot the error and despite rolling back successfully the page continued to error out.

@helvetta Both local and production have the same data.

@jlrdw I'm going to look into what's happening with 7 in addition to inspecting.

jrmypttrsn's avatar

@jlrdw Just to be clear, by 'upgrade Laravel' you mean reading through the upgrade guide, manually changing anything that might break and then running composer update?

jrmypttrsn's avatar

So going over things with my boss, he discovered there is a small set of $tasks that don't have a task_id. So it was fine locally but errored out in production. Frustrating, but it's been fixed. Thanks everyone, especially @jlrdw for the upgrade guide.

Please or to participate in this conversation.