Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Site crashes when page contains a link and a nocache tag #9467

Closed
FlorianMoser opened this issue Feb 6, 2024 · 1 comment
Closed

Site crashes when page contains a link and a nocache tag #9467

FlorianMoser opened this issue Feb 6, 2024 · 1 comment

Comments

@FlorianMoser
Copy link

Bug description

The site loads indefinitely, either crashing with a "502 Bad Gateway" or "Maximum execution time of 30 seconds exceeded", when the page contains a link fieldset and a nocache tag.

How to reproduce

  1. Install a fresh Statamic site using "statamic new project"
  2. Add a link field to the pages Blueprint (see template below)
  3. Edit the home page and select "Entry" (link to any page, no matter. home or another newly created one), save (see .md file below)
  4. Add a {{ nocache }}{{ /nocache }} tag to the home view (see view below)
  5. Now load the home page on the frontend, and the site crashes

Now either remove the entry-link in the home.md file, or remove the {{ nocache }} tag, and the site loads again.

Same also happens with the @nocache directive in Blade.

/resources/blueprints/collections/pages/page.yaml

title: Page
tabs:
  main:
    display: Main
    sections:
      -
        fields:
          -
            handle: title
            field:
              type: text
              required: true
              validate:
                - required
          -
            handle: content
            field:
              type: markdown
              display: Content
              localizable: true
          -
            handle: author
            field:
              type: users
              display: Author
              default: current
              localizable: true
              max_items: 1
          -
            handle: template
            field:
              type: template
              display: Template
              localizable: true
          -
            handle: link_field
            field:
              type: link
              display: 'Link Field'
              listable: hidden
              instructions_position: above
              visibility: visible
              replicator_preview: true
              hide_display: false
  sidebar:
    display: Sidebar
    sections:
      -
        fields:
          -
            handle: slug
            field:
              type: slug
              localizable: true
              validate: 'max:200'
          -
            handle: parent
            field:
              type: entries
              collections:
                - pages
              max_items: 1
              listable: false
              localizable: true

/content/collections/pages/home.md

---
id: home
blueprint: pages
title: Home
template: home
author: 3de44f3d-d06a-4520-b0a7-8099586940e0
updated_by: 3de44f3d-d06a-4520-b0a7-8099586940e0
updated_at: 1707228125
link_field: 'entry::f0e2251d-40f1-4f7d-8325-917414497767'
---
## Welcome to your brand new Statamic site!

Not sure where to do next? Here are a few ideas, but feel free to explore in your own way, in your own time.

- [Jump into the Control Panel](/cp) and edit this page or begin setting up your own collections and blueprints.
- [Head to the docs](https://statamic.dev) and learn how Statamic works.
- [Watch some Statamic videos](https://youtube.com/statamic) on YouTube.
- [Join our Discord chat](https://statamic.com/discord) and meet thousands of other Statamic developers.
- [Start a discussion](https://github.com/statamic/cms/discussions) and get answers to your questions.
- [Star Statamic on Github](https://github.com/statamic/cms) if you enjoy using it!

/resources/views/home.antlers.html

{{ nocache }}
{{ /nocache }}
<article class="mt-4 bg-white p-8 shadow-xl rounded-xl max-w-xl prose">
    {{ content | widont }}
</article>

Logs

No response

Environment

Environment
Application Name: Statamic
Laravel Version: 10.43.0
PHP Version: 8.2.3
Composer Version: 2.5.4
Environment: local
Debug Mode: ENABLED
URL: aaa.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: file

Statamic
Addons: 0
Antlers: runtime
Stache Watcher: Enabled
Static Caching: Disabled
Version: 4.47.0 Solo

Installation

Fresh statamic/statamic site via CLI

Antlers Parser

Runtime (default)

Additional details

No response

@jasonvarga
Copy link
Member

This has been fixed in #9449. I'm getting a release ready now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants