studio1902 / statamic-peak-browser-appearance

Belongs to the Statamic Peak Starter Kit and contains all Browser Appearance related fieldsets and partials.
GNU General Public License v3.0
8 stars 2 forks source link

Generators/Favicons.php fails: file_get_contents(): SSL operation failed with code 1 #9

Closed prikkprikkprikk closed 11 months ago

prikkprikkprikk commented 11 months ago

Bug description

On our (multisite) website, after upgrading to statamic-peak-browser-appearance 3.3.0, favicons won't generate on my local environment, as file_get_contents() in Generators/Favicons.php:43 doesn't work.

It works when switching https off (valet unsecure), but that's hardly unexpected.

Copying Laravel Valet's CA certificate to OpenSSL's certs folder also seems to have helped (copied it from ~/.config/valet/CA into /opt/homebrew/etc/openssl@3/certs) and it seems to save, although it ends with an error notification, but no logs in storage/logs/laravel.log.

How to reproduce

(Logs show result.)

Logs

[2023-11-27 11:42:24] local.ERROR: file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:0A000086:SSL routines::certificate verify failed {"userId":1,"exception":"[object] (ErrorException(code: 0): file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages:
error:0A000086:SSL routines::certificate verify failed at /Users/prikkprikkprikk/code/vk/vendor/studio1902/statamic-peak-browser-appearance/src/Generators/Favicons.php:43)
[stacktrace]
#0 /Users/prikkprikkprikk/code/vk/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php(254): Illuminate\\Foundation\\Bootstrap\\HandleExceptions->handleError(2, 'file_get_conten...', '/Users/prikkpri...', 43)
#1 [internal function]: Illuminate\\Foundation\\Bootstrap\\HandleExceptions->Illuminate\\Foundation\\Bootstrap\\{closure}(2, 'file_get_conten...', '/Users/prikkpri...', 43)
#2 /Users/prikkprikkprikk/code/vk/vendor/studio1902/statamic-peak-browser-appearance/src/Generators/Favicons.php(43): file_get_contents('https://vk.test...')
#3 /Users/prikkprikkprikk/code/vk/vendor/studio1902/statamic-peak-browser-appearance/src/Generators/Favicons.php(32): Studio1902\\PeakBrowserAppearance\\Generators\\Favicons::createThumbnail('viken-kompetans...', 'no/icon-180.png', 180, 180, '#FFFFFF', 15)
#4 /Users/prikkprikkprikk/code/vk/vendor/laravel/framework/src/Illuminate/Collections/Traits/EnumeratesValues.php(238): Studio1902\\PeakBrowserAppearance\\Generators\\Favicons::Studio1902\\PeakBrowserAppearance\\Generators\\{closure}(Object(Statamic\\Sites\\Site), 'no')
#5 /Users/prikkprikkprikk/code/vk/vendor/studio1902/statamic-peak-browser-appearance/src/Generators/Favicons.php(20): Illuminate\\Support\\Collection->each(Object(Closure))
#6 /Users/prikkprikkprikk/code/vk/vendor/studio1902/statamic-peak-browser-appearance/src/Listeners/GenerateFavicons.php(25): Studio1902\\PeakBrowserAppearance\\Generators\\Favicons::generate()

Environment

Environment
Application Name: Viken Kompetanse
Laravel Version: 10.33.0
PHP Version: 8.2.11
Composer Version: 2.6.5
Environment: local
Debug Mode: ENABLED
URL: vk.test
Maintenance Mode: OFF

Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: CACHED

Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: database

Filament
Packages: filament, forms, notifications, support, tables
Version: v3.0.102
Views: PUBLISHED: filament

Livewire
Livewire: v3.2.1

Statamic
Addons: 8
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.36.0 PRO

Statamic Addons
insight-media/statamic-pdf-thumbnailer: 1.0.1
jacksleight/statamic-bard-mutator: 2.3.0
jonassiewertsen/statamic-livewire: 3.0.0
mitydigital/iconamic: 1.1.6
studio1902/statamic-peak-browser-appearance: 3.3.0
studio1902/statamic-peak-commands: 2.7.0
studio1902/statamic-peak-seo: 7.3.0
studio1902/statamic-peak-tools: 3.4.3

Installation

Fresh statamic/statamic site via CLI

Antlers Parser

runtime (new)

Additional details

Mac Sonoma 14.0 with Laravel Valet.

marcorieser commented 11 months ago

Probably related to #8

robdekort commented 11 months ago

Hey it seems file_get_contents() leads to issues when using self signed certificates. Maybe you can find a working solution here: https://stackoverflow.com/questions/26148701/file-get-contents-ssl-operation-failed-with-code-1-failed-to-enable-crypto

Not sure if this is something we should fix at our level. Closing for now, we can always revisit this.