Skip to content

Ability to store reports in the database #698

Open

Description

@jure-knezovic

Bug description

Reports cannot be generated on hosts whose filesystem is not shared between instances or does not survive a deploy - Laravel Cloud with autoscaling in our case, but the same applies to any container or serverless setup.

Reports, their chunks and their pages are written with the File facade to a hard-coded storage_path('statamic/seopro/reports') (Reporting\Report::path(), Reporting\Chunk, Reporting\Page). That is the local disk of whichever instance happens to run the code:

  • Clicking Generate opens reports/create, which writes storage/statamic/seopro/reports/1/report.yaml on the instance that served the request and redirects to reports/1. The redirect is routed to another instance, Report::find(1) finds no file there, and the show page answers 404. With two or more web instances this happens most of the time.
  • The generation itself is queued (Artisan::queue('statamic:seo-pro:generate-report')), so the chunk files and the finished report.yaml are written on the queue worker's disk, which no web instance can read.
  • A deploy replaces every instance, so even a report that did show up is gone afterwards.

Expected: a report that was created can be opened, and a generated one stays available - as redirects and 404 tracking already do, since they can be stored in the database (redirects.driver, errors.driver). Reports have no storage option at all.

A way out would be a reports.disk config key naming a disk from config/filesystems.php (an S3 bucket on such hosts), with the local storage directory as the default so nothing changes for existing installations.

I have a branch for that and would open a pull request against this issue.

How to reproduce

  1. Run a Statamic site with SEO Pro on Laravel Cloud (or any host with more than one web instance and an ephemeral filesystem), with a queue worker.
  2. In the control panel open Tools > SEO Pro > Reports and click Generate.
  3. Land on /cp/seo-pro/reports/1 with a 404.
  4. Reload the reports index a few times: the report appears or not, depending on which instance answers.

Logs

Environment

Environment
Laravel Version: 13.35.0
PHP Version: 8.5.11
Composer Version: 2.10.3
Environment: production
Debug Mode: OFF
Maintenance Mode: OFF
Timezone: Europe/Berlin
Locale: de

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

Drivers
Broadcasting: reverb
Cache: redis
Database: mysql
Logs: laravel-cloud-socket
Mail: smtp
Queue: cloud
Scout: elastic
Session: cookie

Storage
public/storage: NOT LINKED

Laradocs
AI Chat: disabled
Banner: disabled
Caching: enabled
Docs Path: documentation
Route Prefix: /docs
Search Driver: auto
Theme: auto

Statamic
Addons: 7
License Key: Set
Sites: 8 (Deutsch, Englisch, Französisch, and 5 more)
Stache Watcher: Disabled (auto)
Static Caching: half
Version: 6.35.1 PRO

Statamic Addons
jacksleight/statamic-bard-texstyle: 4.2.4
ryanmitchell/statamic-translation-manager: 3.1.1
statamic/eloquent-driver: 5.12.2
statamic/mailables-viewer: 1.1.0
statamic/seo-pro: 7.15.1
teamnovu/statamic-images-missing-alt: 2.0.0
xndbogdan/statamic-bard-text-color: 6.0.1

Statamic Eloquent Driver
Addon Settings: eloquent
Asset Containers: file
Assets: eloquent
Blueprints: file
Collection Trees: eloquent
Collections: file
Entries: eloquent
Fieldsets: file
Form Submissions: eloquent
Forms: file
Global Sets: file
Global Variables: eloquent
Navigation Trees: eloquent
Navigations: file
Revisions: eloquent
Sites: file
Taxonomies: file
Terms: eloquent
Tokens: eloquent

Additional details

No response

Activity

  1. duncanmcclean commented on Oct 20, 2026

    @duncanmcclean
    Member

    As I've explained in the PR, I think we should make it possible to store reports in a database, like you can with other Statamic things.

    Making the filesystem configurable feels like a "workaround" to me and doesn't follow the convention set by Statamic with things like entries, terms, etc.

  2. added and removed
    bugSomething isn't working
    on Oct 20, 2026
  3. changed the title [-]Reports cannot be generated on hosts with ephemeral or per-instance filesystems (Laravel Cloud, autoscaling): 404 after Generate[/-] [+]Ability to store reports in the database[/+] on Oct 20, 2026
  4. jure-knezovic commented on Oct 20, 2026

    @jure-knezovic
    Author

    Yes, that would be the proper fix. I just needed quick fix for our customer. Will make a PR for that

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions