Closed ghost closed 7 years ago
try to clear the views cache on your production server.
@lancemattson any chance you're running supervisor to process email jobs ?
When this error pops up, I run
php artisan cache:clear
php artisan clear-compiled
php artisan view:clear
supervisorctl reread
supervisorctl update
supervisorctl restart all
Rendering the views directly doesn't trigger an error, but supervisor has to be updated. I'll try to setup a test bench
@themsaid Clearing the views cache on my production server did not resolve the issue.
I actually ended up just removing the 'subcopy' component from all my email views. It wasnt a feature I absolutely needed.
@Lucassifoni I dont believe my production server is using 'supervisor' to process email jobs, but I will look into it and see if that could be the issue. Its good to hear that someone else has at least come across this error.
Thanks for your comments!
@lancemattson maybe not supervisor but anything using compiled views. This error only occurs after updates for me, and it seems that queue workers compile the jobs once and still use their version after a composer update or similar tinkering.
I only have limited comprehension of how those things are executed, I should dive into it instead of assuming this is the root cause.
I'll keep you updated if I ever encounter the cause of this precise issue !
Closing for lack of activity and being unable to replicate, please ping me in case anybody else was able to replicate this issue.
I am getting same error.
@shihabudheenf it seems there's been difficulty reproducing the error. Can you provide a minimal, complete, and verifiable example?
@QWp6t it was my issue, I was upgraded application from 5.5 to 5.7, so 'or' depreciated and need to use '??' instead of that, i removed all 'or` code from mail template and now issue fixed.
Had same issue, as @shihabudheenf says, if after a Laravel upgrade to 5.7, it's about making sure all blade templates are up to date (or
to ??
) as per upgrading docs on blade section.
To elaborate on @alariva's solution, I had Laravel's mail templates published in my views directory (resources/views/vendor/mail). These were published prior to the 5.7 upgrade and they all contained the or
syntax. Once I deleted them and re-published them I was back up and running.
I had this same error, and fixed it by changing in the mail layout:
from:
{{ $subcopy or '' }}
to:
{{ $subcopy ?? '' }}
Note that I had upgraded my laravel version from 5.x -> 6.0
Description:
The 'subcopy' component in my Markdown template is throwing an ErrorException, but only in my production environment.
Steps To Reproduce:
I switched to using Markdown email in my Laravel app recently. In some of my markdown templates I've included "subcopy" components. Example of my Markdown template is here:
When released to my production environment, I get the following error:
ErrorException: Undefined variable: subcopy (View: /var/www/vhosts/my.planetlabel.com/resources/views/vendor/mail/html/message.blade.php)
The same emails work fine on my development and staging environments, which for the most part mirror my production environment. I dont necessarily have to use the 'subcopy' component, but I am curious why it works fine on my development and staging environments, but not on my production environment.