Skip to content

Flashed session only deleted after second request #859

@Wiejeben

Description

@Wiejeben

Bug Report

Hi,

Currently working on implementing user authentication on our website. With this I'm using craft.app.session.getAllFlashes(true) to show all flashes and immediately delete them.

However I have noticed that on pages with craft.blitz.includeCached(...) anywhere on the page it would keep the session and is displayed again on the next request. On pages without any cached includes this the session is deleted immediately.

Diagnostics Report

Application Info

  • PHP version: 8.3.20
  • Craft edition & version: Pro 5.8.20
  • Database driver & version: MySQL 9.4.0

Installed Plugins

  • Blitz: 5.12.5
  • CKEditor: 4.11.0
  • Craftagram: 4.2.3
  • Hyper: 2.2.10
  • Multi Translator: 2.21.1
  • oEmbed: 3.1.6
  • Retour: 5.0.12
  • SEOmatic: 5.1.19
  • Social Login: 2.0.11
  • Views Work: 2.2.1
  • Vite: 5.0.1

Loaded Modules

  • module: modules\Module
  • codeeditor: nystudio107\codeeditor\CodeEditor
  • sprig-core: putyourlightson\sprig\Sprig
  • verbb-base: verbb\base\Base

Blitz Plugin Settings

{
    "debug": false,
    "hintsEnabled": false,
    "cachingEnabled": true,
    "refreshCacheEnabled": true,
    "refreshMode": 1,
    "includedUriPatterns": [
        ...
    ],
    "excludedUriPatterns": [],
    "cacheStorageType": "putyourlightson\\blitz\\drivers\\storage\\FileStorage",
    "cacheStorageSettings": {
        "folderPath": "@webroot\/dist\/blitz"
    },
    "cacheStorageTypes": [],
    "cacheGeneratorType": "putyourlightson\\blitz\\drivers\\generators\\HttpGenerator",
    "cacheGeneratorSettings": {
        "concurrency": 3
    },
    "cacheGeneratorTypes": [],
    "customSiteUris": [],
    "cachePurgerType": "putyourlightson\\blitz\\drivers\\purgers\\DummyPurger",
    "cachePurgerSettings": [],
    "cachePurgerTypes": [],
    "deployerType": "putyourlightson\\blitz\\drivers\\deployers\\DummyDeployer",
    "deployerSettings": [],
    "deployerTypes": [],
    "ssiEnabled": true,
    "ssiTagFormat": "<!--#include virtual=\"{uri}\" -->",
    "detectSsiEnabled": true,
    "esiEnabled": false,
    "cachedIncludePathParam": "p",
    "onlyCacheLowercaseUris": false,
    "cacheActionRequests": false,
    "queryStringCaching": 0,
    "includedQueryStringParams": [
        {
            "enabled": true,
            "queryStringParam": ".*"
        }
    ],
    "excludedQueryStringParams": [
        {
            "enabled": true,
            "queryStringParam": "gclid"
        },
        {
            "enabled": true,
            "queryStringParam": "fbclid"
        }
    ],
    "apiKey": "",
    "generatePagesWithQueryStringParams": true,
    "purgeAssetImagesWhenChanged": true,
    "refreshCacheAutomaticallyForGlobals": false,
    "refreshCacheWhenElementMovedInStructure": true,
    "refreshCacheWhenElementSavedUnchanged": false,
    "refreshCacheWhenElementSavedNotLive": false,
    "refreshExpiredCacheAfterVisit": true,
    "cacheNonHtmlResponses": false,
    "trackElements": true,
    "trackElementQueries": true,
    "excludedTrackedElementQueryParams": [],
    "cacheDuration": null,
    "nonCacheableElementTypes": [],
    "sourceIdAttributes": [],
    "liveStatuses": [],
    "integrations": [
        "putyourlightson\\blitz\\drivers\\integrations\\CommerceIntegration",
        "putyourlightson\\blitz\\drivers\\integrations\\FeedMeIntegration",
        "putyourlightson\\blitz\\drivers\\integrations\\SeomaticIntegration"
    ],
    "defaultCacheControlHeader": "no-store",
    "cacheControlHeader": "public, s-maxage=31536000, max-age=0",
    "cacheControlHeaderExpired": "public, s-maxage=5, max-age=0",
    "sendPoweredByHeader": true,
    "outputComments": true,
    "refreshCacheJobPriority": 10,
    "driverJobBatchSize": 100,
    "driverJobPriority": 100,
    "queueJobTtr": 14400,
    "maxRetryAttempts": 10,
    "maxUriLength": 2048,
    "maxUriIndexLength": 767,
    "mutexTimeout": 1,
    "commands": [],
    "injectScriptEvent": "DOMContentLoaded",
    "injectScriptPosition": 3
}

Recommendations

  • ❌ Image transforms are configured not to be generated before page load.
  • ❌ The blitz/cache/refresh-expired console command has not been executed within the past 24 hours.
  • ✅ Blitz is configured not to refresh cached pages when an element is saved but unchanged.
  • ✅ Blitz is configured not to refresh cached pages when an element is saved but not live.
  • ✅ No globals exist.
  • ✅ The @web alias is not used in the base URL of any sites.
  • ✅ Queue jobs are configured not to run automatically via web requests.
  • ✅ The Async Queue plugin is not installed or enabled.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions