-
Notifications
You must be signed in to change notification settings - Fork 78
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
Serialization of 'PDO' is not allowed, when using eloquent assets in a no cache region #291
Comments
What makes you sure it's the assets? It seems youre using eloquent globals and they are in your template too - it could be them. |
As soon as I swap assets to file based it works. It could be a combination of both which I can have a go at testing |
Are you able to add a dd($region) here so I can inspect the data its attempting to store? |
So it looks like nocache regions without assets are being affected, and assets are not really causing the problem. Removing any glide tags or asset tags in the templates doesn't resolve the issues on those regions either. I've tried setting globals to file and that hasn't fixed it either. Completely removing any content within the nocache regions also doesn't seem to fix it. Only changing assets back to the file driver fixes it. Below are some examples of nocache regions which cause the page to error. {{ if consent:enable }}
{{ consent:categories }}
{{ if force }}
{{ head_scripts }}
{{ else }}
<template id="{{ title | slugify }}-head" data-position="head">
{{ head_scripts }}
</template>
{{ /if }}
{{ /consent:categories }}
{{ /if }} {{ if consent:enable }}
<template id="consent">
<div class="c-consent js-consent" data-categories="{{ consent:categories }}{{ title | slugify}}{{ last ? '' : ',' }}{{ /consent:categories }}">
<div class="c-consent__container">
<div class="c-consent__content">
<h3 class="c-consent__title">
{{ consent:banner_title }}
</h3>
<div class="c-consent__copy is-quarantine">
{{ consent:banner_copy }}
</div>
</div>
<div class="c-consent__actions">
<button type="button" class="c-button c-button--orange js-consent__accept-all" aria-label="Accept all">
Confirm
</button>
</div>
</div>
</div>
</template>
{{ consent:categories }}
{{ if force }}
{{ scripts }}
{{ else }}
<template id="{{ title | slugify }}-body" data-position="body">
{{ scripts }}
</template>
{{ /if }}
{{ /consent:categories }}
{{ /if }} <div class="c-basket">
<button class="c-basket__button" @click="open('basket')">
{{ svg src="basket" }}
<span class="c-basket__count">
{{ sc:cart:quantityTotal }}
</span>
</button>
<template x-teleport="body" >
<div class="c-basket__portal"
x-show="isOpen('basket')"
x-transition.500ms
x-cloak
@click.outside="close()"
x-trap.noscroll="isOpen('basket') && isMobile()">
<div class="c-basket-modal">
<div class="c-basket-modal__container">
{{ if { sc:cart:quantityTotal } !== 0 }}
<div class="c-basket-modal__items">
{{ sc:cart:items }}
{{ partial:products.partials.basket }}
{{ /sc:cart:items }}
<div class="c-basket-modal__totals">
<span class="c-basket-modal__total">{{ trans:newby.total }}</span>
<span class="c-basket-modal__total">{{ sc:cart:total }}</span>
</div>
<div class="c-basket-modal__actions">
<a href="/cart" class="c-button c-button--purple c-button--large">
</a>
<a href="/checkout" class="c-button c-button--orange c-button--large">
{{ trans:newby.continue_checkout }}
{{ svg src="arrow-right" }}
</a>
</div>
</div>
{{ else }}
<div class="c-basket-modal__empty">
{{ trans:newby.empty_basket }}
</div>
<div class="c-basket-modal__actions">
<a href="{{ mount_url handle="products" }}" class="c-button c-button--orange c-button--large">
{{ trans:newby.shop_products }}
{{ svg src="arrow-right" }}
</a>
</div>
{{ /if }}
</div>
</div>
</div>
</template>
</div> {{ if {cookie:has key="hide_newsletter"} != true }}
<div class="c-newsletter" x-data="Newsletter" x-show="!checkState(0)" :class="{ 'is-active': checkState(2)}" x-transition.opacity x-cloak>
<div class="c-newsletter__modal" @click.outside="close()" x-trap.noscroll="checkState(2)">
<button class="c-newsletter__close" @click="downgrade()">
{{ svg src="cross" }}
</button>
<header class="c-newsletter__tab" @click="upgrade()">
<span class="c-newsletter__tab-title">
{{ shared_content:newsletter_heading }}
</span>
</header>
<div x-collapse x-show="checkState(2)">
<form action="https://emailoctopus.com/lists/73eaf5b2-8b02-11eb-a3d0-06b4694bee2a/members/embedded/1.3s/add"
method="post"
data-message-success="Thanks for subscribing!"
data-message-missing-email-address="Your email address is required."
data-message-invalid-email-address="Your email address looks incorrect, please try again."
data-message-bot-submission-error="This doesn't look like a human submission."
data-message-consent-required="Please check the checkbox to indicate your consent."
data-message-invalid-parameters-error="This form has missing or invalid fields."
data-message-unknown-error="Sorry, an unknown error has occurred. Please try again later."
class="c-newsletter__container"
data-sitekey="6LdYsmsUAAAAAPXVTt-ovRsPIJ_IVhvYBBhGvRV6"
>
<h3 class="c-newsletter__title">
{{ shared_content:newsletter_title }}
</h3>
<div class="c-newsletter__copy">
{{ shared_content:newsletter_intro }}
</div>
<div class="c-newsletter__fields">
<div class="o-field o-field--center o-field--100">
<input id="field_0"
type="email"
name="field_0"
class="c-input o-field__control"
placeholder=" "
required
/>
<label class="o-field__label" for="field_0">
Email
</label>
</div>
<div class="o-field o-field--center o-field--100">
<label class="c-toggle ">
<input type="checkbox" class="c-toggle__control" name="terms" required />
<span>{{ trans:newby.forms.terms url="{site_details:terms:url}" }}</span>
</label>
</div>
</div>
<div class="c-newsletter__actions">
<button type="submit" class="c-button">
{{ button_label ?? 'Submit'}}
</button>
</div>
</form>
</div>
</div>
</div>
{{ /if }} {{ form:create form="{form|raw}" class="o-form" redirect="{redirect_url}" }}
{{ if success }}
<div class="o-form__row">
{{ if success_message }}
<div class="is-quarantine">
{{ success_message }}
</div>
{{ else }}
<span class="c-status c-status--success">
Thank you for your submission
</span>
{{ /if }}
</div>
{{ else }}
<div class="o-form__fields">
{{ fields }}
{{ partial:components.field }}
{{ /fields }}
{{ turnstile }}
</div>
{{ if honeypot }}
<div class="u-sr">
<label for="{{ honeypot }}">Do not fill</label>
<input type="text" name="{{ honeypot }}" id="{{ honeypot }}"/>
</div>
{{ /if }}
<div class="o-form__toggles">
<label class="c-toggle">
<input type="checkbox" class="c-toggle__control" name="terms" required />
<span>{{ trans:newby.forms.terms url="{site_details:terms:url}" }}</span>
</label>
<label class="c-toggle">
<input type="checkbox" class="c-toggle__control" name="mailing" id="mailing" />
<span>{{ trans:newby.forms.mailing }}</span>
</label>
</div>
<div class="o-form__actions">
<button type="submit" class="c-button">
{{ button_label ?? 'Submit'}}
</button>
</div>
{{ /if }}
{{ /form:create }} |
What about adding select="zzz|yyy" to the region so you only store the data you need? |
That doesn't have an effect. Even a region without any variables throws the error
|
I can't see any reason for this - @duncanmcclean do you have any ideas? |
I don't have any ideas off the top of my head. I'd probably need to have a dig around to figure out what's causing it. @byron-roots Are you able to share access to the repo or reproduce the issue on a fresh Statamic site? |
I can't add you to the repository, could I send it as a support ticket? |
Sure, you can send it in as a support request: https://statamic.com/support |
I've done a little bit of digging. From what I can tell, it seems like it has something to do with the In the blueprint, the field looks like this, just a normal assets field: -
handle: media
field:
mode: list
container: assets
restrict: false
allow_uploads: true
show_filename: true
show_set_alt: true
type: assets
display: Media
icon: assets
listable: hidden
instructions_position: above
visibility: visible
hide_display: false In the {{ shared_content:hotlinks }}
<div class="c-hotlinks__item">
{{ partial:general.article article_class="c-article--center" :article_image="media" }}
</div>
{{ /shared_content:hotlinks }} If I comment out the When I I need to head off now but wanted to leave some notes here for future me or someone else who ends up looking into this. |
Thanks for looking into that, much appreciated. I'll have another dig around and see if I can find out anything else |
Setting the max_files option to 1 on the asset field appears to fix the issue |
Bug description
I've been trying to migrate our assets to eloquent, but when using assets in a nocache region we get an error
Serialization of 'PDO' is not allowed
Below is the template we use and removing nocache tags fixes the issue
How to reproduce
Logs
Environment
Additional details
No response
The text was updated successfully, but these errors were encountered: