eta icon indicating copy to clipboard operation
eta copied to clipboard

Eta Error: Loading file: C:\...\views\homepage.eta failed: Cannot read property 'replace' of undefined

Open GamerGirlandCo opened this issue 4 years ago • 2 comments

Describe the bug none of my templates are rendering. everything fails with this error:

Eta Error: Loading file: C:\diamond-head-org\views\homepage.eta failed:

Cannot read property 'replace' of undefined
    at EtaErr (C:\diamond-head-org\node_modules\eta\src\err.ts:26:15)
    at loadFile (C:\diamond-head-org\node_modules\eta\src\file-handlers.ts:53:11)
    at handleCache (C:\diamond-head-org\node_modules\eta\src\file-handlers.ts:81:10)
    at tryHandleCache (C:\diamond-head-org\node_modules\eta\src\file-handlers.ts:99:26)
    at View.renderFile [as engine] (C:\diamond-head-org\node_modules\eta\src\file-handlers.ts:241:10)
    at View.render (C:\diamond-head-org\node_modules\express\lib\view.js:135:8)
    at tryRender (C:\diamond-head-org\node_modules\express\lib\application.js:640:10)
    at Function.render (C:\diamond-head-org\node_modules\express\lib\application.js:592:3)
    at ServerResponse.render (C:\diamond-head-org\node_modules\express\lib\response.js:1012:7)
    at C:\diamond-head-org\routes\misc.ts:11:6
    at step (C:\diamond-head-org\routes\misc.ts:33:23)
    at Object.next (C:\diamond-head-org\routes\misc.ts:14:53)
    at C:\diamond-head-org\routes\misc.ts:8:71
    at new Promise (<anonymous>)
    at __awaiter (C:\diamond-head-org\routes\misc.ts:4:12)
    at C:\diamond-head-org\routes\misc.ts:10:27

To Reproduce Steps to reproduce the behavior:

  1. call res.render from express

Expected behavior the template to render.

Screenshots N/A; error is shown above.

Package & Environment Details

  • Node
  • Version: 15.0.1

Additional context i've searched everywhere in my views directory for any calls to .replace, however the only results are client-side js, i.e., not wrapped in <? and ?> (my chosen delimiters)

image

my configuration, in case it's relevant:

eta.configure({
	cache: true,
	tags: ["<?", "?>"],
	varName: "_"
});

GamerGirlandCo avatar Oct 28 '21 14:10 GamerGirlandCo

update: i restarted nodemon and now there's no issues.... weird, but i'm glad it's resolved (for now)

GamerGirlandCo avatar Oct 28 '21 15:10 GamerGirlandCo

update 2: it's spitting out the error again, even after restarting.

GamerGirlandCo avatar Oct 28 '21 15:10 GamerGirlandCo

@GamerGirlandCo were you able to resolve the issue?

bgub avatar Jan 28 '23 03:01 bgub

@GamerGirlandCo were you able to resolve the issue?

yep! turns out that it was because one of the variables i passed to the render function was named "tags", which eta already uses internally.

GamerGirlandCo avatar Jan 29 '23 23:01 GamerGirlandCo