ssg
ssg copied to clipboard
Call to a member function url() on null
Running PHP 7.4.29 (cli) (built: Apr 14 2022 11:36:10) ( NTS )
php please ssg:generate
outputs the following:
Gathering content to be generated...
Error
Call to a member function url() on null
at vendor/statamic/ssg/src/Request.php:51
47▕ }
48▕
49▕ public function getPathInfo(): string
50▕ {
➜ 51▕ return $this->page->url();
52▕ }
53▕
54▕ public function path()
55▕ {
+27 vendor frames
28 [internal]:0
Statamic\Stache\Indexes\Value::Statamic\Stache\Indexes\{closure}(Object(Statamic\Entries\Entry), "1845791e-ed19-4114-a585-fb2ae1905e9b")
+7 vendor frames
36 [internal]:0
Statamic\Stache\Query\EntryQueryBuilder::Statamic\Stache\Query\{closure}("blog")
```
Note:
I have a `blog` collection and a `blog` page within the `pages` collection.
Was able to solve this by calling php please stache:warm
before php please ssg:generate
.
Not quite sure why that became required all of a sudden as my installation didn't require it in the past? 🤔
My ssg generation ran into the same error today (statamic v3.17 & ssg v1.0.1, php 8, parallel mode).
Thanks @kyranb this helped me too. And I agree, I didn't need this before. Every month I do an SSG deployment and for the last few months I've had some SSG bug or issue to resolve before it will build successfully. Thinking SSG needs some TLC to keep up to date with all the awesome changes happening in Statamic core.
This is still an issue on
"statamic/cms": "3.3.45",
"statamic/ssg": "^1.2",
even with:
php artisan cache:clear && php please glide:clear && php please ssg:generate
Ran into this issue today.
Was able to solve with @kyranb's solution to please stache:warm
first before please ssg:generate