statamic / ssg

The official Statamic Static Site Generator
229 stars 23 forks source link

Static Site Generator randomly generates entries with incorrect site URLs #170

Open o1y opened 1 week ago

o1y commented 1 week ago

Bug description

We have a multi-site where the URLs are sometimes generated incorrectly. This can result in a URI redirecting to the wrong site language, for example, you're on the Default Site and the link leads to a different site.

How to reproduce

In my case this seems to happen with the link field type. This is my template:

  <a
    class="btn"
    role="button"
    href="{{ _link | antlers }}">{{ _label }}
  </a>

This bug is completely random. It's almost impossible to reproduce, but it happens since Statamic 5. I would guess it's because of one of the new introduced cache commits, but I don't know how to create a reliable reproduction case 🤷‍♂️

Logs

No response

Environment

Environment
Application Name: Statamic
Laravel Version: 11.7.0
PHP Version: 8.3.8
Composer Version: 2.7.6
Environment: local
Debug Mode: ENABLED
URL: localhost:8080
Maintenance Mode: OFF

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

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

Statamic
Addons: 3
Sites: 11 (English, Deutsch, Español, and 8 more)
Stache Watcher: Enabled
Static Caching: Disabled
Version: 5.7.3 PRO

Statamic Addons
jacksleight/statamic-bard-mutator: 2.3.1
jacksleight/statamic-bard-texstyle: 3.2.2
statamic/ssg: 3.0.1

Installation

Fresh statamic/statamic site via CLI

Additional details

No response

o1y commented 6 days ago

In the re-implementation of #10280, the return values of fields() are cached using Blink. This also affects frontend augmentation, and it's possible for incorrect values of an entry in one language to leak into another locale of the entry.

Oops. 🤷‍♂️