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

syntax.split is not a function #2571

Closed
zachleat opened this issue Sep 22, 2022 · 6 comments
Closed

syntax.split is not a function #2571

zachleat opened this issue Sep 22, 2022 · 6 comments
Labels
bug feature: 🧀 edge The Eleventy Edge plugin release: canary A release on the canary channel

Comments

@zachleat
Copy link
Member

zachleat commented Sep 22, 2022

Build-time error (not runtime):

[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] 1. Having trouble rendering liquid template ./src/tests/liquid-md.md (via TemplateContentRenderError)
[11ty] 2. syntax.split is not a function, file:./src/tests/liquid-md.md, line:8, col:35 (via RenderError)
[11ty] 3. syntax.split is not a function (via TypeError)
[11ty] 
[11ty] Original error stack trace: TypeError: syntax.split is not a function
[11ty]     at Object.renderAsLiquid (/Users/zachleat/Code/demo-eleventy-edge/node_modules/@11ty/eleventy/src/Plugins/EdgePlugin.js:119:26)
[11ty]     at Object.render (/Users/zachleat/Code/demo-eleventy-edge/node_modules/@11ty/eleventy/src/Plugins/Edge/LiquidEdge.js:43:23)
[11ty]     at Tag.<anonymous> (/Users/zachleat/Code/demo-eleventy-edge/node_modules/liquidjs/dist/liquid.node.cjs.js:4454:47)
[11ty]     at step (/Users/zachleat/Code/demo-eleventy-edge/node_modules/liquidjs/dist/liquid.node.cjs.js:88:23)
[11ty]     at Object.next (/Users/zachleat/Code/demo-eleventy-edge/node_modules/liquidjs/dist/liquid.node.cjs.js:69:53)
[11ty]     at /Users/zachleat/Code/demo-eleventy-edge/node_modules/liquidjs/dist/liquid.node.cjs.js:1599:38
[11ty]     at step (/Users/zachleat/Code/demo-eleventy-edge/node_modules/liquidjs/dist/liquid.node.cjs.js:88:23)
[11ty]     at Object.next (/Users/zachleat/Code/demo-eleventy-edge/node_modules/liquidjs/dist/liquid.node.cjs.js:69:53)
[11ty]     at fulfilled (/Users/zachleat/Code/demo-eleventy-edge/node_modules/liquidjs/dist/liquid.node.cjs.js:59:58)
[11ty] Copied 5 files / Wrote 0 files in 0.31 seconds (v2.0.0-canary.15)

Pinned this down to a regression in liquidjs 9.42.0, canary-16 will be pinned to 9.41.0.

To workaround this locally, just add "liquidjs": "9.41.0", to your package.json under dependencies.

@zachleat zachleat added bug feature: 🧀 edge The Eleventy Edge plugin labels Sep 22, 2022
@zachleat
Copy link
Member Author

cc @harttle I was able to narrow this down to an extra token being returned here (which resulted in extra internal-to-liquid arguments):

while (!tokenizer.end()) {
let value = tokenizer.readValue();
if (!value) {
break;
}
this.args.push(value);
}

@zachleat
Copy link
Member Author

Specifically this was being returned as a token when I don’t think it should be?

{
    next: [Function (anonymous)],
    throw: [Function (anonymous)],
    return: [Function (anonymous)],
    [Symbol(Symbol.iterator)]: [Function (anonymous)]
  }

zachleat added a commit that referenced this issue Sep 22, 2022
@zachleat
Copy link
Member Author

2.0.0-canary.16 has shipped with liquidjs pinned to 9.41.0

@zachleat zachleat added the release: canary A release on the canary channel label Sep 23, 2022
@harttle
Copy link
Contributor

harttle commented Sep 25, 2022

Specifically this was being returned as a token when I don’t think it should be?

No, it shouldn't. I can't see how it can be. Do you have a tagToken.args value (used to init the Tokenizer) to repro? Maybe it's broken elsewhere, it'll help if we have a runable snippet.

const tokenizer = new Tokenizer(tagToken.args);
this.args = [];
while (!tokenizer.end()) {
let value = tokenizer.readValue();
if (!value) {
break;
}
this.args.push(value);
}

@zachleat
Copy link
Member Author

zachleat commented Dec 6, 2022

I got this fixed up! I wasn’t evaluating my tokens correctly in the render function.

@zachleat zachleat added this to the Eleventy 2.0.0 milestone Dec 6, 2022
@zachleat
Copy link
Member Author

zachleat commented Dec 6, 2022

Shipping with 2.0.0-canary.19

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug feature: 🧀 edge The Eleventy Edge plugin release: canary A release on the canary channel
Projects
None yet
Development

No branches or pull requests

2 participants