laravellaravel-8swiftmailersymfony-mailer

Syntax error, unexpected token ")" when sending mail in laravel 8


I know the title seems familiar but hear me out...

My code works locally when I try to send out an invoice via email and the email gets sent. However, I deployed the same code to production on ec2 and got this error; enter image description here

My controller looks like this...

public function invoice_send(Request $request, Invoice $invoice)
{
    Mail::to($request->to)->queue(new NewInvoice($invoice, $request));

    return redirect()->route('invoice.show', $invoice);
}

The vendor folder is the only thing that is different between production and development servers so I deleted the vendor and run composer install again but that didn't solve anything.

Any ideas?


Solution

  • You are queueing the email. It could be that an old version of your code is used for processing the queue. You can have a look at the Laravel documentation about this. Try restarting the queue-worker if configured.