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

Trouble with nunjucks include inside edge function #2585

Closed
TixieSalander opened this issue Oct 1, 2022 · 3 comments
Closed

Trouble with nunjucks include inside edge function #2585

TixieSalander opened this issue Oct 1, 2022 · 3 comments
Labels
feature: 🧀 edge The Eleventy Edge plugin needs-triage

Comments

@TixieSalander
Copy link

Describe the bug

Including njk files with the {% include 'file' %} shortcode inside a eleventy edge function (so inside a {% edge %} shortcode) makes the netlify-cli crash and return those errors:

◈ Reloaded edge function eleventy-edge
ERROR {
  e: (unknown path)
  Template render error: (unknown path)
  TypeError: Cannot read properties of undefined (reading 'length'), file:liquid, line:26, col:13
   24| Include in Edge:
   25| 
>> 26| {% endraw %}{% renderTemplate "njk,md" %}EleventyEdgeNunjucksPrecompile:ff52dcc677df32747974b84753251a34758479e15b80a2e93bdab560ef24568a{% endrenderTemplate %}{% raw %}
   27| 
   28|     </main>
   29| 
RenderError: (unknown path)
  Template render error: (unknown path)
  TypeError: Cannot read properties of undefined (reading 'length'), file:liquid, line:26, col:13
    at RenderError2.LiquidError2 [as constructor] (https://cdn.11ty.dev/[email protected]/eleventy-edge.js:32252:28)
    at new RenderError2 (https://cdn.11ty.dev/[email protected]/eleventy-edge.js:32290:28)
    at Render2.<anonymous> (https://cdn.11ty.dev/[email protected]/eleventy-edge.js:35440:49)
    at step (https://cdn.11ty.dev/[email protected]/eleventy-edge.js:31244:23)
    at Object.throw (https://cdn.11ty.dev/[email protected]/eleventy-edge.js:31191:18)
    at https://cdn.11ty.dev/[email protected]/eleventy-edge.js:33814:32
    at step (https://cdn.11ty.dev/[email protected]/eleventy-edge.js:31244:23)
    at Object.throw (https://cdn.11ty.dev/[email protected]/eleventy-edge.js:31191:18)
    at rejected (https://cdn.11ty.dev/[email protected]/eleventy-edge.js:31169:36)
    at Object.runMicrotasks (deno:core/01_core.js:297:30)
From Template render error: (unknown path)
  Template render error: (unknown path)
  TypeError: Cannot read properties of undefined (reading 'length')
    at Object._prettifyError (https://cdn.11ty.dev/[email protected]/eleventy-edge.js:24601:15)
    at https://cdn.11ty.dev/[email protected]/eleventy-edge.js:29678:24
    at file:///Users/tixie/Sources/demo-11ty-edge-include/netlify/edge-functions/_generated/eleventy-edge-app.js:64:11
    at https://cdn.11ty.dev/[email protected]/eleventy-edge.js:29293:9
    at RawTask.call (https://cdn.11ty.dev/[email protected]/eleventy-edge.js:24964:19)
    at flush (https://cdn.11ty.dev/[email protected]/eleventy-edge.js:24902:29)
    at processTicksAndRejections (https://deno.land/[email protected]/node/_next_tick.ts:51:13)
}

To Reproduce

Steps to reproduce the behavior:

  1. Clone the example repo available at https://github.com/TixieBorg/demo-11ty-edge-include
  2. npm i + npm run dev
  3. If not already, load the dev server's page (usually at http://localhost:8888)
  4. The error should be displayed on your terminal

Expected behavior

Display the included file without error

My dev environment

  • OS and Version: macOS 12.6
  • Eleventy Version: 2.0.0-canary.15

Additional context

There is this similar issue who have been closed without a solution since it wasn't easy to reproduce. I hope this one will with the help of the demo repo.

@zachleat zachleat added the feature: 🧀 edge The Eleventy Edge plugin label Feb 7, 2023
@ItsEthanH
Copy link

Did anything come of this? I'm getting a similar issue myself :/ Weird how it it says file:liquid, even though I've defined .html to be read as .njk

image

@joepavitt
Copy link

joepavitt commented Mar 23, 2023

Also hit these issues - workaround for me was to use liquid for the {% edge "liquid" %} templating instead: #2879

@zachleat
Copy link
Member

Per the Eleventy Community Survey results and our refocus and prioritization towards our roots as a static site generator, we’re going to be deprecating Edge in 3.0 and closing issues related to the Edge plugin. I’m very sorry to have to do this—but unfortunately this was a necessary decision to allow the project to continue forward.

Read more:
https://www.zachleat.com/web/eleventy-side-project/
https://www.11ty.dev/blog/community-survey-results/

@zachleat zachleat closed this as not planned Won't fix, can't repro, duplicate, stale Nov 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature: 🧀 edge The Eleventy Edge plugin needs-triage
Projects
None yet
Development

No branches or pull requests

4 participants