eleventy
eleventy copied to clipboard
Serverless pages can't access collections
Describe the bug I've got a template being used by the Serverless plugin. It can't seem to access collections.
To Reproduce Try to use collections in a serverless page. :)
Expected behavior That it should work. If it isn't supposed to work, then it should be documented.
Cross posting discussion from Twitter here https://twitter.com/roobottom/status/1459106529781686285
Notably,
For the record
precompiledCollections
is a stop gap—the goal is to get collections working on serverless without manual intervention.
Is this supposed to work with 11ty 1.0.0
?
I reproduced what you shared, but in my serverless page collections
is still empty.
@zachleat is there any sort of release version aim for this being included as standard without manual intervention? I'm working on a project that requires this, but don't want to invest too much time if it's something that might be coming shortly.
Thanks as always! ❤️
I ran into this bug too, and @zachleat suggested in https://github.com/11ty/eleventy/issues/2437 that I use Edge functions, which I finally had a chance to try out today.
With them, I'm seeing collections.all
is undefined
inside of the {% edge "liquid" %}
blocks. The branch I used to test is here. Am I doing something wrong, or might there be another regression?
Let me know if I should create a new issue. Thanks again!
Stale per project slipstream changes in #3074.