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

Local Generator fails while HTTP Generator doesn't #444

Closed
naboo opened this issue Sep 16, 2022 · 10 comments
Closed

Local Generator fails while HTTP Generator doesn't #444

naboo opened this issue Sep 16, 2022 · 10 comments
Labels
bug Something isn't working

Comments

@naboo
Copy link

naboo commented Sep 16, 2022

We are having an issue with the Local Generator when warming the site cache. The Local Generator failes after X pages (almost always on the same page) but if we switch to the HTTP Generator it works everytime.

Attached are the console, queue and blitz log files (env. information removed).

Craft version: 4.2.3
Blitz version: 4.2.1

queue-2022-09-16.log
console-2022-09-16.log
blitz-2022-09-16.log

@naboo naboo added the bug Something isn't working label Sep 16, 2022
@bencroker
Copy link
Collaborator

I'm not seeing anything in the Blitz log file, which is where I would expect to see errors. Can you provide any more details about how exactly it fails?

@naboo
Copy link
Author

naboo commented Sep 18, 2022

So what I did now was I cleared all the logs. Then I cleared the entire cache in Blitz and ran "Generate all pages" and after page ~62 of 437 pages I just stops. Then those three log files are the ones getting created. No visitors or anything during the process. It's just me.

If I do exactly the same with the HTTP Generator all pages gets generated as they should.

Can there be something in the template(s) that the Local Generator gets stuck on which the HTTP Generator doesn't since Craft mutes the frontend error for the site? But internally twig catches it? I'm thinking about that URLHelper error.

@bencroker
Copy link
Collaborator

Yes, it does look like it's related.

craft\helpers\UrlHelper::url(): Argument #1 ($path) must be of type string, null given, called in /home/craft/********.com/storage/runtime/compiled_templates/10/10e34c248e5a7b4ac207f68c4732f6ab.php on line 48

Can you check around line 48 in /storage/runtime/compiled_templates/10/10e34c248e5a7b4ac207f68c4732f6ab.php?

@naboo
Copy link
Author

naboo commented Sep 19, 2022

So here's the line @bencroker:
\Craft::$app->getResponse()->redirect(craft\helpers\UrlHelper::url(($context["companyEntryUrl"] ?? null)), 302);
I'm guessing there's an entry which can't be find. I'll look into this today and see if this is it.

@bencroker
Copy link
Collaborator

Ok, so it in indeed looks like there's a case where the value passed into UrlHelper::url is null. Perhaps you could rewrite it to be more robust by checking that companyEntryUrl is not null beforehand?

@naboo
Copy link
Author

naboo commented Sep 20, 2022

Small update. We are working through the template errors and so far whenever we fix something the Local Generator goes a little bit further. So this might be 100% twig errors. I'll report back once we are done. But maybe something to figure out anyways? Right now if there's a twig error the warming just halts.

@bencroker
Copy link
Collaborator

It does sound like Twig errors. Keep checking the logs until you fix them all up. I'll look into allowing the Local Generator to carry on even when it encounters errors.

@bencroker
Copy link
Collaborator

bencroker commented Sep 20, 2022

This should resolve the Local Generator failing, feel free to test:
9b15890#diff-72fab4ca2c17457a2fd0ef39eeb4480369756d782bc260c7b31c65c63b7b173a

@naboo
Copy link
Author

naboo commented Sep 21, 2022

The Local Generator now runs as it should @bencroker. Great update! Thanks

@naboo naboo closed this as completed Sep 21, 2022
@bencroker
Copy link
Collaborator

bencroker commented Sep 21, 2022

Glad to hear it, be sure to fix up those errors though, they should be logged to blitz.log as well now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants