Troubleshooting | laravel-og-image-go | Spatie       

 SPATIE  

laravel-og-image-go
===================

spatie.be/open-source

  [Docs](https://spatie.be/docs)  [Laravel-og-image-go](https://spatie.be/docs/laravel-og-image-go/v1)  Advanced-usage  Troubleshooting

 Version   v1      

 Other versions for crawler [v1](https://spatie.be/docs/laravel-og-image-go/v1) 

  Troubleshooting    
- [ Introduction ](https://spatie.be/docs/laravel-og-image-go/v1/introduction)
- [ Requirements ](https://spatie.be/docs/laravel-og-image-go/v1/requirements)
- [ Installation &amp; setup ](https://spatie.be/docs/laravel-og-image-go/v1/installation-setup)
- [ Questions and issues ](https://spatie.be/docs/laravel-og-image-go/v1/questions-issues)
- [ Testing ](https://spatie.be/docs/laravel-og-image-go/v1/testing)
- [ Releasing ](https://spatie.be/docs/laravel-og-image-go/v1/releasing)
- [ Changelog ](https://spatie.be/docs/laravel-og-image-go/v1/changelog)
- [ Support us ](https://spatie.be/docs/laravel-og-image-go/v1/support-us)
- [ About us ](https://spatie.be/docs/laravel-og-image-go/v1/about-us)

Basic usage
-----------

- [ How it works ](https://spatie.be/docs/laravel-og-image-go/v1/basic-usage/how-it-works)
- [ Getting started ](https://spatie.be/docs/laravel-og-image-go/v1/basic-usage/getting-started)
- [ Customizing screenshots ](https://spatie.be/docs/laravel-og-image-go/v1/basic-usage/customizing-screenshots)
- [ Defining fallback images ](https://spatie.be/docs/laravel-og-image-go/v1/basic-usage/defining-fallback-images)
- [ Caching and storage ](https://spatie.be/docs/laravel-og-image-go/v1/basic-usage/managing-caching-and-storage)
- [ Pre-generating images ](https://spatie.be/docs/laravel-og-image-go/v1/basic-usage/pre-generating-images)
- [ Clearing generated images ](https://spatie.be/docs/laravel-og-image-go/v1/basic-usage/clearing-generated-images)

Advanced usage
--------------

- [ Customizing the page URL ](https://spatie.be/docs/laravel-og-image-go/v1/advanced-usage/customizing-the-page-url)
- [ Using a custom screenshot driver ](https://spatie.be/docs/laravel-og-image-go/v1/advanced-usage/using-a-custom-screenshot-driver)
- [ Customizing the screenshot layout ](https://spatie.be/docs/laravel-og-image-go/v1/advanced-usage/customizing-the-screenshot-layout)
- [ Customizing actions ](https://spatie.be/docs/laravel-og-image-go/v1/advanced-usage/customizing-actions)
- [ Troubleshooting ](https://spatie.be/docs/laravel-og-image-go/v1/advanced-usage/troubleshooting)
- [ Using a hosted solution ](https://spatie.be/docs/laravel-og-image-go/v1/advanced-usage/using-a-hosted-solution)
- [ Using Laravel Boost ](https://spatie.be/docs/laravel-og-image-go/v1/advanced-usage/using-laravel-boost)

 Troubleshooting
===============

###  On this page 

1. [ Chrome/Chromium not found ](#content-chromechromium-not-found)
2. [ Blank or broken screenshots ](#content-blank-or-broken-screenshots)
3. [ Timeout issues ](#content-timeout-issues)
4. [ Cache invalidation ](#content-cache-invalidation)
5. [ Debugging with ?ogimage ](#content-debugging-with-ogimage)
6. [ Security ](#content-security)

Chrome/Chromium not found
---------------------------------------------------------------------------------------------------------------------------------

The default driver needs Node.js, Puppeteer and Chrome/Chromium. Check the [Browsershot Go installation instructions](https://github.com/spatie/browsershot-go) and configure its Chrome path if the binary is not in a standard location.

Blank or broken screenshots
-----------------------------------------------------------------------------------------------------------------------------------------

The screenshot preserves the original `<head>`. Keep stylesheets and font links there, and check that Chrome can reach their URLs. Relative asset paths resolve against the actual preview page URL.

Wait for loading to finish if needed:

```
c.ConfigureScreenshot = func(s *ogimage.Screenshot) {
    s.WaitUntil = "networkidle0"
    s.Delay = 500 * time.Millisecond
}
```

Timeout issues
--------------------------------------------------------------------------------------------------

`LockTimeout` defaults to a minute. Set it longer than the maximum screenshot duration, otherwise another process could acquire the expired lock while Chrome is still running. Use request and driver timeouts to bound browser work.

Cache invalidation
--------------------------------------------------------------------------------------------------------------

Changing template HTML changes its hash. Changing CSS or global settings does not. Use `laravel og-image:clear` after those changes. Clearing Laravel's application cache also removes the URL mapping. The next page visit restores it.

If generation returns 404 after clearing storage, metadata may have expired. Visit the original page first. Increase `MetadataTTL` for rarely visited pages.

Debugging with ?ogimage
---------------------------------------------------------------------------------------------------------------------------

Append `?ogimage` to a page URL to inspect exactly what Chrome sees. Check the dimensions, styles and fonts. For pages outside the web route group, explicitly attach `ogimage.Render{}` or call `Service.Prepare` from your own response pipeline.

Security
--------------------------------------------------------------------------------

Only render trusted application templates and fetch trusted URLs. HTML helpers do not sanitize markup. Previews and browser fetches can reach private services. This package is not an SSRF sandbox or an authorization boundary. Never put private content in a publicly reachable OG image.

 A good
match?
-------------

### What we do best

- All things Laravel
- Custom frontend components
- Building APIs
- AI-powered features
- Simplifying things
- Clean solutions
- Integrating services

### Not our cup of tea

- WordPress themes
- Cutting corners
- Free mockups to win a job
- "Just execute the briefing"

 In short: we'd like to be a **substantial part** of your project.

 [ Get in touch via email ](mailto:info@spatie.be?subject=A%20good%20match%21&body=Tell%20us%20as%20much%20as%20you%20can%20about%0A-%20your%20online%20project%0A-%20your%20planning%0A-%20your%20budget%0A-%20%E2%80%A6%0A%0AAnything%20that%20helps%20us%20to%20start%20straightforward%21)
