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

Time:08-02

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?

CodePudding user response:

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.

CodePudding user response:

I resolved this by downgrading my PHP version from 8.1.8 to 8.0.21.

  • Related