widgetFile does not treat the lucius file as optional, 500 error
Closed this issue · 3 comments
Hey all,
I'm new to Yesod, very excited to get my project up and running.
This is a low priority issue, I'm just sharing my workaround, and hoping to join the community here.
I've read the book, and I started with a new Yesod scaffold project. The default-layout.lucius
was doing some styling I didn't want, so I deleted it.
The book seems to suggest that widgetFile
only takes action if the .lucius etc files exist.
From Foundation.hs:
pc <- widgetToPageContent $ do
-- addStylesheet $ StaticR css_bootstrap_css
$(widgetFile "default-layout")
withUrlRenderer $(hamletFile "templates/default-layout-wrapper.hamlet")
But I'm getting a 500 Internal server error when default-layout.lucius
is not there.
Here is the output from stack exec -- yesod devel
:
[Error#yesod-core] templates/default-layout.lucius: openFile: does not exist (No such file or directory) @(yesod-core-1.6.9-7g4SwkDmJJ261rdNBKrLzX:Yesod.Core.Class.Yesod ./Yesod/Core/Class/Yesod.hs:662:5)
[Error#yesod-core] Error handler errored out: InternalError "templates/default-layout.lucius: openFile: does not exist (No such file or directory)" @(yesod-core-1.6.9-7g4SwkDmJJ261rdNBKrLzX:Yesod.Core.Internal.Run ./Yesod/Core/Internal/Run.hs:210:21)
GET /example
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Status: 500 Internal Server Error 0.0051s
I'm running:
command -v yesod && yesod version
/Users/user/.local/bin/yesod
yesod-bin version: 1.6.0.3
Workaround:
I simply put the file back and deleted the CSS out of it, and while Firefox gives an error that it can't load that auto-generated CSS file, it doesn't 500 error any more.
I am hoping to learn something about this / hope for this to be the answer that someone is googling for in the future.
Ben
What happens if you delete the file and run stack clean
?
That did the trick! Sorry I didn't know this command, I'll do this when feeling superstitious before posting in future.
I'll have a hunt around for a "troubleshooting" / FAQ / "debugging tips" area on the site / wiki, and see if I can contribute back 😊
Thanks Michael!
No worries! This is a limitation/bug in Yesod, but it's one we can't work around AFAICT. It has to do with the recompilation detection in GHC, and not wanting to cause too many recompiles.