[Laravel Sail] ExcecuteJavascriptMiddleware not firing
Closed this issue · 3 comments
I am wanting to use this Middleware but it is not firing. I had an issue as I am using Laravel Sail on an M1 Mackbook and installing puppeteer had issues due to chromium not being arm64 ready:
The chromium binary is not available for arm64.
so I did the following.
I installed spatie/browsershot and ran
sail PUPPETEER_EXPERIMENTAL_CHROMIUM_MAC_ARM=1 npm i puppeteer
and everything seemed to install correctly but the ExcecuteJavascriptMiddleware doesn't appear to being called so I still get the:
<noscript>You need to enable JavaScript to run this app.</noscript>\n
version of the page returned.
I put breakpoints in ExcecuteJavascriptMiddleware but they never fire.
am I doing something wrong or missed a step?
I am using the Laravel Adaptor so thought the Middleware was already injected in to the Container, am I wrong?
I'm an idiot. I forgot to add it to:
public array $downloaderMiddleware = [
RequestDeduplicationMiddleware::class,
ExecuteJavascriptMiddleware::class
];
However, now the Middleware fires but the handleResponse() fails with the following error:
Error: Could not find expected browser (chrome) locally. Run npm install to download the correct Chromium revision (1022525).\n at ChromeLauncher.launch (/var/www/html/node_modules/puppeteer/lib/cjs/puppeteer/node/ChromeLauncher.js:70:23)\n at async callChrome (/var/www/html/vendor/spatie/browsershot/bin/browser.js:84:23)\n
even though I can see in node_modules/puppeteer
Any advice? Thank you.
I think the arm architecture of chrome does not correctly call the executable file.
I don't have the right device for the test.
But I found a link for your problem:
https://linguinecode.com/post/how-to-fix-m1-mac-puppeteer-chromium-arm64-bug
I'm not familiar with Laravel Sail, unfortunately. So I can't be of much help here 😞