ssg icon indicating copy to clipboard operation
ssg copied to clipboard

Call to a member function url() on null

Open kyranb opened this issue 2 years ago • 5 comments

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.
     
     
     

kyranb avatar Jun 06 '22 18:06 kyranb

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? 🤔

kyranb avatar Jun 27 '22 22:06 kyranb

My ssg generation ran into the same error today (statamic v3.17 & ssg v1.0.1, php 8, parallel mode).

globalexport avatar Jul 01 '22 14:07 globalexport

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.

bradfloodx avatar Sep 23 '22 03:09 bradfloodx

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

bradfloodx avatar Oct 19 '22 03:10 bradfloodx

Ran into this issue today. Was able to solve with @kyranb's solution to please stache:warm first before please ssg:generate

ajp avatar Jan 30 '23 17:01 ajp